有一个项目将涉及到到服务器的sftp文件传输。我已经尝试使用ftp协议,并选择winscp.exe - sftp作为我要录制的节目。有事件正在被记录,但是在我完成记录后没有生成任何东西。
如果ftp协议不是sftp文件传输的答案,谁能给我一些关于如何在sftp文件传输上使用LR进行负载测试的见解或提示?
我使用Loadrunner 11来做这件事。
提前谢谢。
发布于 2016-04-04 22:55:35
SFTP FTP协议不支持LoadRunner。它仅支持FTP和FTPS (FTP over SSL)。您可以尝试使用PuTTY的SFTP psftp工具或类似的控制台客户端和C函数对服务器进行负载测试,这些函数在任何协议的LoadRunner C脚本中都可用。您可以使用CVuser协议来编写这样的脚本。
有关更多信息,请查看这个旧的但仍有一定用处的forum discussion。
发布于 2016-04-05 05:01:25
不是所有的东西都能被记录下来。有些是需要编程的。寻求在C、VB、JavaScript或Java中运行的sftp的应用编程接口解决方案,所有这些都可以用LoadRunner实现
发布于 2016-06-29 21:18:31
您可以使用Java vuser协议执行sftp。你需要编写java代码来传输文件。下面的代码片段可能会有所帮助。
import lrapi.lr;
import com.jcraft.jsch.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
public class Actions
{
public int init() throws Throwable {
return 0;
}//end of init
public int action() throws Throwable {
JSch jsch = new JSch();
Session session = null;
try {
session = jsch.getSession("userId", "HOST",PORT);
session.setConfig("StrictHostKeyChecking", "no");
session.setPassword("Password");
session.connect();
Channel channel = session.openChannel("sftp");
channel.connect();
ChannelSftp sftpChannel = (ChannelSftp) channel;
sftpChannel.cd("Directory to upload files");
System.out.println("Connection Established");
File file = new File("Local folder to upload files");
sftpChannel.put(new FileInputStream(file),file.getName());
sftpChannel.exit();
session.disconnect();
}
catch (JSchException e)
{
e.printStackTrace();
}
return 0;
}
public int end() throws Throwable {
return 0;
}//end of end
}
https://stackoverflow.com/questions/36347220
复制相似问题