51Testing软件测试论坛

标题: 请求帮助,如何用LR模拟本地文件上传的操作。 [打印本页]

作者: gaha    时间: 2010-1-14 11:01
标题: 请求帮助,如何用LR模拟本地文件上传的操作。
就是用脚本实现把本地文件上传到服务器。
开发语言为java,使用的控件是input。当前已经设置成,用户登录后打开的页面只有一个input控件,即点击浏览按钮,选择文件,提交。
搜索了很多相关内容,不管是录制,编写脚本,还是调整HTML选项均不成功,所以走个捷径,请知道的各位指导一下。

以上如有描述不清的地方,后边会继续补充。
作者: skyzhu    时间: 2010-1-14 14:39
web_submit_data("test",
"Action=http://www.xxxxx.com/xxx.xxx",
"Method=POST",
"RecContentType=text/html",
"EncType=multipart/form-data",
"Mode=HTTP",
ITEMDATA,
"Name=file1", "Value=E:\\picture\\tttt1.jpg", "File=yes", ENDITEM,
LAST);
作者: gaha    时间: 2010-1-14 15:12
不行,文件提交不上去。
作者: gaha    时间: 2010-1-15 10:17
再次求答案
作者: aman_cao    时间: 2010-1-17 11:25
基于smartupload的文件上传脚本实现:
Action()
{

        web_url("uploadDemo02.html",
                "URL=http://localhost:8080/Demo/upload/uploadDemo02.html",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t1.inf",
                "Mode=HTTP",
                LAST);

        lr_think_time(12);

        web_submit_data("smartupload01.jsp",
                "Action=http://localhost:8080/Demo/upload/smartupload01.jsp",
                "Method=POST",
                "EncType=multipart/form-data",
                "RecContentType=text/html",
                "Referer=http://localhost:8080/Demo/upload/uploadDemo02.html",
                "Snapshot=t2.inf",
                "Mode=HTTP",
                ITEMDATA,
                "Name=pic", "Value=C:\\Documents and Settings\\administrator\\桌面\\build.xml", "File=Yes", ENDITEM,
                LAST);

        return 0;
}
作者: hucongjun    时间: 2010-7-22 11:27
Loadrnner 上传文件录制选择什么协议呢?HTTP?还是FTP?
作者: msnshow    时间: 2010-7-22 13:40
要看你的上传本身用什么协议的
作者: xihong2004    时间: 2011-3-22 10:02
关注中
作者: kuangquanshui    时间: 2011-3-22 10:52
不是太了解   帮你顶了兄弟
作者: yandaju    时间: 2011-8-12 13:57
提交不上去是什么意思?再说的详细点。




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2