2013年3月27日星期三

loadrunner录制ftp协议脚本

FTP协议是一种低级协议,用来模拟用户在ftp服务器上的动作,比如登陆、传输文件,断开连接等操作
可以通过录制FTP会话或手动输入ftp函数来生成脚本
步骤:
1.打开vuser,新建,目录选择E-business,选择ftp协议,
2.弹出的录制选项,选择ie或win32应用(ftp客户端)
3.ftp操作,完成录制,生成脚本
常用函数:
*ftp_login
登陆ftp
语法:init ftp_logon(char *transaction,char *url [attributes,]LAST);
示例:ftp_logon("FTPlogon","URL=ftp://test1:123456@servaername:port",LAST);
如果匿名用户则为anoymous,端口号可省略

*ftp_logout:注销ftp连接
语法:int ftp_logout()
示例:ftp_logou();

*ftp_Logon_ex 通过指定的会话登陆ftp
语法:int ftp_logon_ex(FTP *ppftp,char *transaction,char *url,[attributes,] LAST);
示例:ftp1=0;
ftp_logon_ex(&ftp1,"ftplogon","url=URL=ftp://test1:123456@servaername",last)

*ftp_put将文件上传ftp服务器
语法:int ftp_put(char *transaction,<item list>LAST);
示例:ftp_put("ftp_put","source_path=ftpfile_1.dat","target_path=temp/test.txt",LATS);

*ftp_get从ftp服务器获取文件
语法:int ftp_get(char *transaction,<item list>LAST);
示例:ftp_get("ftp_get","source_path=/home/test.txt","target_path=d:/test.txt","PASSIVE=TRUE",ENDITEM,LATS);

*ftp_dir 指定目录执行dir命令
语法:int ftp_dir(char *transaction,<item list>LAST);
示例:ftp_dir("ftp_dir","path=pub/test"LAST);
 显示test目录下的文件和子目录

*ftp_delete:删除ftp文件
*ftp_rendir:重命名文件
*ftp_rmdir:删除文件夹
*ftp_mkdir:建立文件夹



没有评论:

发表评论