51Testing软件测试论坛

标题: 关于loadrunner上传文件脚本如何修改 [打印本页]

作者: runer3023    时间: 2013-6-19 12:31
标题: 关于loadrunner上传文件脚本如何修改
Loadrunner将文件上传到服务器,并要将记录加入到数据库,要怎么做啊?急求各位高手指点,谢谢
作者: runer3023    时间: 2013-6-19 13:58
急,高手多指教啊,谢谢
作者: runer3023    时间: 2013-6-19 15:17
本帖最后由 runer3023 于 2013-6-19 16:56 编辑

版主,有认识高手吗??帮我指点指点啊,谢谢!!也可以留下QQ我加你啊!!!
作者: 金小言    时间: 2013-6-19 16:05
同求!~
作者: omg    时间: 2013-6-19 21:12
菜鸟发言,你要把你的脚本,你的程序的背景等等说清楚,让大神们知道你的问题所在,才能给你帮助。
作者: runer3023    时间: 2013-6-20 16:24
不好意思,就是这样一个脚本,不知道怎么修改才可以上传,烦高手指点,谢谢!!

Action()
{
        web_add_cookie("lu01010101010101010101=; DOMAIN=192.168.1.136");
        //web_add_cookie("_hiddenAdmin_=123456; DOMAIN=192.168.1.136");
        //web_add_cookie("admin=123456; DOMAIN=192.168.1.136");
        web_url("login",
                "URL=http://192.168.1.136/manage/login",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t1.inf",
                "Mode=HTML",
                EXTRARES,
                "Url=../skins/images/top_bg.jpg", ENDITEM,
                "Url=../skins/images/focus_bg.jpg", ENDITEM,
                "Url=../skins/images/spot.png", ENDITEM,
                "Url=../skins/images/login_bot_bg.png", ENDITEM,
                "Url=../skins/images/login_top_bg.png", ENDITEM,
                "Url=../skins/images/login_bg.png", ENDITEM,
                "Url=../skins/images/login_dt_bg.png", ENDITEM,
                "Url=../skins/images/block_bg.jpg", ENDITEM,
                "Url=../skins/images/name_bg.png", ENDITEM,
                "Url=../skins/images/pwd.png", ENDITEM,
                "Url=../skins/images/button.png", ENDITEM,
                "Url=../skins/images/foot_top.jpg", ENDITEM,
                "Url=../skins/images/foot.png", ENDITEM,
                "Url=../skins/images/button_hover.png", ENDITEM,
                LAST);
        web_custom_request("wdinfo.php",
                "URL=http://qurl.f.360.cn/wdinfo.php",
                "Method=POST",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/plain",
                "Referer=",
                "Snapshot=t2.inf",
                "Mode=HTML",
                "EncType=application/octet-stream",
                "BodyBinary=\\x1E\n\\x01\\x02\\x00\\xEC\\x00\\x00\\x01\\x10\\x01wro♂\\xCE\\x18\\xD7=C\\x7F6\r殐\\x00\\x00\\x00\\x05桄O鴎\\xBC\\x14yT\\x8E.\\xE4\\x07\\xF96涜]^o\\x1Aln\\xED,棼)o趍湐\\xFB%圪ㄋ&`烖^薷O鳡蓞~'9\\xF65暣鞫\\x17H萬z簢鋂!tI>烟6赵\\x0B诰靟P鬇\\xD0.\\x9A?阇屔侂\\xAC!澩_箛<'iK┮摨F9とS楒.\n飺C泑\\xC1\\x0B\\xC9\\x1CS聍\\xEE\\x173fo t褷\\x1B蚼\\x13\\x17{\\x90(\\x05M-ET胁j秸靔稄湘{\t臘\\xF7;攪^镑肛\\\\{U<埩筺NY{x鼮\\xF3\\x13\n\\x12\\xE7)\\xDC=\\x0CN\\x08壕行栞c恊\\xA73\\\\轈\\x9C)\\x90 "
                "HX\\x9A2C樰w馢蕾\\x80\\x98 d\\xF3\\x0E\\x08|\\x1C跒l疗=\\x86!縨|\\x18\\\\\\x18*轖M<1y\\x98",
                LAST);
        web_custom_request("wdinfo.php_2",
                "URL=http://qurl.f.360.cn/wdinfo.php",
                "Method=POST",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/plain",
                "Referer=",
                "Snapshot=t3.inf",
                "Mode=HTML",
                "EncType=application/octet-stream",
                "BodyBinary=\\x1E\n\\x01\\x02\\x00\\xEC\\x00\\x00\\x00涵鹓\\x0C\\x91\\x18蘪>唊\\xC4\r_\\x00\\x00\\x00\\x05炳喦/刕W甝\\x0E醖\\x9F;w贽#\\x91:p a(錱\\x9C\\x18S]\\x96$\\x0FZ裼u),'\\x89\\x1F馺沛J\\x8D\"w索矽++\\x1C\\xE5\\x03伖a珮(蚹4\\x00鴲寽j靽浖褢詤;9<営蹛10\\xD6\\x1E#9縡桦\\xE7*~\"拇妛\\x7FK-恄\\x1BO异圯\\x0Fh21C嬻<\\xE6-愡|\\x1C睓l朠\\xEE\\x18\\xE4\\x1E\\x178酾~{丟k\\xFF<>8\tC睨茣尀跔\\xC3",
                LAST);

        /* Request with GET method to URL "http://192.168.1.136/favicon.ico" failed during recording. Server response : 404*/
        web_submit_data("login_2",
                "Action=http://192.168.1.136/manage/login",
                "Method=POST",
                "TargetFrame=",
                "RecContentType=text/html",
                "Referer=http://192.168.1.136/manage/login",
                "Snapshot=t4.inf",
                "Mode=HTML",
                ITEMDATA,
                "Name=username", "Value={username}", ENDITEM,
                "Name=password", "Value={pwd}", ENDITEM,
                EXTRARES,
                "Url=../skins/css/css.css", "Referer=http://192.168.1.136/manage/home.jsp?now=2013-06-18+23%3A37%3A23.435", ENDITEM,
                "Url=../skins/images/appImages/page5.png", "Referer=http://192.168.1.136/manage/home.jsp?now=2013-06-18+23%3A37%3A23.435", ENDITEM,
                LAST);

        web_url("My97DatePicker.htm",
                "URL=http://192.168.1.136/scripts/My97DatePicker/My97DatePicker.htm",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=http://192.168.1.136/manage/home.jsp?now=2013-06-18+23%3A37%3A23.435",
                "Snapshot=t5.inf",
                "Mode=HTML",
                EXTRARES,
                "Url=/skins/images/appImages/page6.png", "Referer=http://192.168.1.136/manage/home.jsp?now=2013-06-18+23%3A37%3A23.435", ENDITEM,
                "Url=lang/zh-cn.js", ENDITEM,
                "Url=skin/default/datepicker.css", ENDITEM,
                "Url=skin/whyGreen/datepicker.css", ENDITEM,
                "Url=skin/default/img.gif", ENDITEM,
                LAST);

        /* Request with POST method to URL "http://activex.microsoft.com/objects/ocget.dll" failed during recording. Server response : 404*/

        web_url("3",
                "URL=http://192.168.1.136/manage/sublogin/login/3",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=http://192.168.1.136/manage/home.jsp?now=2013-06-18+23%3A37%3A23.435",
                "Snapshot=t6.inf",
                "Mode=HTML",
                EXTRARES,
                "Url=http://192.168.1.136:8083/skins/images/foot.png", "Referer=http://192.168.1.136:8083/manage/tactivity/newindex?now=2013-06-18+23%3A37%3A30.847", ENDITEM,
                "Url=http://192.168.1.136:8083/skins/newcss/images/l_hover.jpg", "Referer=http://192.168.1.136:8083/manage/tactivity/newindex?now=2013-06-18+23%3A37%3A30.847", ENDITEM,
                LAST);

        /* Request with GET method to URL "http://192.168.1.136:8083/home/images/favicon.ico" failed during recording. Server response : 404*/
        web_url("发券",
                "URL=http://192.168.1.136:8083/manage/tsendtask/new",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=http://192.168.1.136:8083/manage/tactivity/newindex?now=2013-06-18+23%3A37%3A30.847",
                "Snapshot=t7.inf",
                "Mode=HTML",
                EXTRARES,
                "Url=/skins/newcss/images/btn.gif", ENDITEM,
                "Url=/skins/newcss/images/fr_but.png", ENDITEM,
                "Url=/scripts/My97DatePicker/lang/zh-cn.js", ENDITEM,
                "Url=/scripts/My97DatePicker/skin/default/datepicker.css", ENDITEM,
                "Url=/scripts/My97DatePicker/calendar.js?", ENDITEM,
                "Url=/scripts/My97DatePicker/skin/default/img.gif", ENDITEM,
                LAST);

        /* Request with GET method to URL "http://192.168.1.136:8083/skins/newcss/images/s_bg.jpg" failed during recording. Server response : 404*/

        lr_think_time(1800);

         web_submit_data("0",
                "Action=http://192.168.1.136:8083/manage/tsendtask/calTaskMoney2/2/0",
                "Method=POST",
                "EncType=multipart/form-data",
                "TargetFrame=",
                "RecContentType=text/html",
                "Referer=http://192.168.1.136:8083/manage/tsendtask/new",
                "Snapshot=t8.inf",
                "Mode=HTML",
                ITEMDATA,
                "Name=staskid", "Value=", ENDITEM,
                "Name=activityid", "Value=2", ENDITEM,
                "Name=vilidtimes", "Value=1", ENDITEM,
                "Name=sendmode", "Value=0", ENDITEM,
                "Name=sendnum", "Value=", ENDITEM,
                "Name=sfilename", "Value=", ENDITEM,
                "Name=starttimeString", "Value=2013-06-18 11:37:30", ENDITEM,
                "Name=type", "Value=1", ENDITEM,
                "Name=file", "Value=E:\\loadrunner\\mobile\\template2.txt", "File=Yes", NDITEM,
                "Name=mobile", "Value=", ENDITEM,
                "Name=customername", "Value=", ENDITEM,
                "Name=customersortnum", "Value=", ENDITEM,
                "Name=customer_radio", "Value=1", ENDITEM,
                "Name=customernum", "Value=-1", ENDITEM,
                LAST);
        lr_think_time(1000);
        web_submit_data("tsendtask",
                "Action=http://192.168.1.136:8083/manage/tsendtask",
                "Method=POST",
                "EncType=multipart/form-data",
                "TargetFrame=",
                "RecContentType=text/html",
                "Referer=http://192.168.1.136:8083/manage/tsendtask/new",
                "Snapshot=t9.inf",
                "Mode=HTML",
                ITEMDATA,
                "Name=staskid", "Value=", ENDITEM,
                "Name=activityid", "Value=2", ENDITEM,
                "Name=vilidtimes", "Value=1", ENDITEM,
                "Name=sendmode", "Value=0", ENDITEM,
                "Name=sendnum", "Value=2", ENDITEM,
                "Name=sfilename", "Value=20130618233754.txt", ENDITEM,
                "Name=starttimeString", "Value=2013-06-18 11:37:30", ENDITEM,
                "Name=type", "Value=1", ENDITEM,
                "Name=file", "Value=E:\\loadrunner\\mobile\\template2.txt", "File=Yes", ENDITEM,
                "Name=mobile", "Value=", ENDITEM,
                "Name=customername", "Value=", ENDITEM,
                "Name=customersortnum", "Value=", ENDITEM,
                "Name=customer_radio", "Value=1", ENDITEM,
                "Name=customernum", "Value=-1", ENDITEM,
                EXTRARES,
                "Url=../skins/newcss/images/card_bt.gif", "Referer=http://192.168.1.136:8083/manage/tsendtask?now=2013-06-18+23%3A37%3A55.876", ENDITEM,
                "Url=../skins/images/icon_flash_success.gif", "Referer=http://192.168.1.136:8083/manage/tsendtask?now=2013-06-18+23%3A37%3A55.876", ENDITEM,
                "Url=../skins/newcss/images/new_add.gif", "Referer=http://192.168.1.136:8083/manage/tsendtask?now=2013-06-18+23%3A37%3A55.876", ENDITEM,
                LAST);

        web_url("logout",
                "URL=http://192.168.1.136:8083/manage/login/logout",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t10.inf",
                "Mode=HTML",
                LAST);
        return 0;
}
作者: runer3023    时间: 2013-6-20 16:27
就这样一个脚本,帮忙看看,谢谢!!
Action()
{

        web_add_cookie("lu01010101010101010101=; DOMAIN=192.168.1.136");

        //web_add_cookie("_hiddenAdmin_=123456; DOMAIN=192.168.1.136");

        //web_add_cookie("admin=123456; DOMAIN=192.168.1.136");

        web_url("login",
                "URL=http://192.168.1.136/manage/login",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t1.inf",
                "Mode=HTML",
                EXTRARES,
                "Url=../skins/images/top_bg.jpg", ENDITEM,
                "Url=../skins/images/button_hover.png", ENDITEM,
                LAST);

        web_custom_request("wdinfo.php",
                "URL=http://qurl.f.360.cn/wdinfo.php",
                "Method=POST",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/plain",
                "Referer=",
                "Snapshot=t2.inf",
                "Mode=HTML",
                "EncType=application/octet-stream",
                "BodyBinary=\\x1E\n\\x01\\x02\\x00\\xEC\\x00\\x00\\x01\\x10\\x01wro♂\\xCE\\x18\\xD7=C\\x7F6\r殐\\x00\\x00\\x00\\x05桄O鴎\\xBC\\x14yT\\x8E.\\xE4\\x07\\xF96涜]^o\\x1Aln\\xED,棼)o趍湐\\xFB%圪ㄋ&`烖^薷O鳡蓞~'9\\xF65暣鞫\\x17H萬z簢鋂!tI>烟6赵\\x0B诰靟P鬇\\xD0.\\x9A?阇屔侂\\xAC!澩_箛<'iK┮摨F9とS楒.\n飺C泑\\xC1\\x0B\\xC9\\x1CS聍\\xEE\\x173fo t褷\\x1B蚼\\x13\\x17{\\x90(\\x05M-ET胁j秸靔稄湘{\t臘\\xF7;攪^镑肛\\\\{U<埩筺NY{x鼮\\xF3\\x13\n\\x12\\xE7)\\xDC=\\x0CN\\x08壕行栞c恊\\xA73\\\\轈\\x9C)\\x90 "
                "HX\\x9A2C樰w馢蕾\\x80\\x98 d\\xF3\\x0E\\x08|\\x1C跒l疗=\\x86!縨|\\x18\\\\\\x18*轖M<1y\\x98",
                LAST);

        web_custom_request("wdinfo.php_2",
                "URL=http://qurl.f.360.cn/wdinfo.php",
                "Method=POST",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/plain",
                "Referer=",
                "Snapshot=t3.inf",
                "Mode=HTML",
                "EncType=application/octet-stream",
                "BodyBinary=\\x1E\n\\x01\\x02\\x00\\xEC\\x00\\x00\\x00涵鹓\\x0C\\x91\\x18蘪>唊\\xC4\r_\\x00\\x00\\x00\\x05炳喦/刕W甝\\x0E醖\\x9F;w贽#\\x91:p a(錱\\x9C\\x18S]\\x96$\\x0FZ裼u),'\\x89\\x1F馺沛J\\x8D\"w索矽++\\x1C\\xE5\\x03伖a珮(蚹4\\x00鴲寽j靽浖褢詤;9<営蹛10\\xD6\\x1E#9縡桦\\xE7*~\"拇妛\\x7FK-恄\\x1BO异圯\\x0Fh21C嬻<\\xE6-愡|\\x1C睓l朠\\xEE\\x18\\xE4\\x1E\\x178酾~{丟k\\xFF<>8\tC睨茣尀跔\\xC3",
                LAST);

        /* Request with GET method to URL "http://192.168.1.136/favicon.ico" failed during recording. Server response : 404*/

        web_submit_data("login_2",
                "Action=http://192.168.1.136/manage/login",
                "Method=POST",
                "TargetFrame=",
                "RecContentType=text/html",
                "Referer=http://192.168.1.136/manage/login",
                "Snapshot=t4.inf",
                "Mode=HTML",
                ITEMDATA,
                "Name=username", "Value={username}", ENDITEM,
                "Name=password", "Value={pwd}", ENDITEM,
                EXTRARES,
                "Url=../skins/css/css.css", "Referer=http://192.168.1.136/manage/home.jsp?now=2013-06-18+23%3A37%3A23.435", ENDITEM,
                "Url=../scripts/My97DatePicker/skin/WdatePicker.css", "Referer=http://192.168.1.136/manage/home.jsp?now=2013-06-18+23%3A37%3A23.435", ENDITEM,
                "Url=../skins/images/appImages/page5.png", "Referer=http://192.168.1.136/manage/home.jsp?now=2013-06-18+23%3A37%3A23.435", ENDITEM,
                LAST);

        web_url("My97DatePicker.htm",
                "URL=http://192.168.1.136/scripts/My97DatePicker/My97DatePicker.htm",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=http://192.168.1.136/manage/home.jsp?now=2013-06-18+23%3A37%3A23.435",
                "Snapshot=t5.inf",
                "Mode=HTML",
                EXTRARES,
                "Url=/skins/images/appImages/page6.png", "Referer=http://192.168.1.136/manage/home.jsp?now=2013-06-18+23%3A37%3A23.435", ENDITEM,
                "Url=lang/zh-cn.js", ENDITEM,
                "Url=skin/default/datepicker.css", ENDITEM,
                "Url=skin/whyGreen/datepicker.css", ENDITEM,
                "Url=skin/default/img.gif", ENDITEM,
                LAST);

        /* Request with POST method to URL "http://activex.microsoft.com/objects/ocget.dll" failed during recording. Server response : 404*/

        web_url("3",
                "URL=http://192.168.1.136/manage/sublogin/login/3",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=http://192.168.1.136/manage/home.jsp?now=2013-06-18+23%3A37%3A23.435",
                "Snapshot=t6.inf",
                "Mode=HTML",
                EXTRARES,
                "Url=http://192.168.1.136:8083/skins/css/css.css", "Referer=http://192.168.1.136:8083/manage/tactivity/newindex?now=2013-06-18+23%3A37%3A30.847", ENDITEM,
                "Url=http://192.168.1.136:8083/skins/newcss/images/l_hover.jpg", "Referer=http://192.168.1.136:8083/manage/tactivity/newindex?now=2013-06-18+23%3A37%3A30.847", ENDITEM,
                LAST);

        /* Request with GET method to URL "http://192.168.1.136:8083/home/images/favicon.ico" failed during recording. Server response : 404*/

        web_url("发券",
                "URL=http://192.168.1.136:8083/manage/tsendtask/new",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=http://192.168.1.136:8083/manage/tactivity/newindex?now=2013-06-18+23%3A37%3A30.847",
                "Snapshot=t7.inf",
                "Mode=HTML",
                EXTRARES,
                "Url=/skins/newcss/images/btn.gif", ENDITEM,
                "Url=/skins/newcss/images/fr_but.png", ENDITEM,
                "Url=/scripts/My97DatePicker/lang/zh-cn.js", ENDITEM,
                "Url=/scripts/My97DatePicker/skin/default/datepicker.css", ENDITEM,
                "Url=/scripts/My97DatePicker/calendar.js?", ENDITEM,
                "Url=/scripts/My97DatePicker/skin/default/img.gif", ENDITEM,
                LAST);

        /* Request with GET method to URL "http://192.168.1.136:8083/skins/newcss/images/s_bg.jpg" failed during recording. Server response : 404*/

        lr_think_time(1800);
                web_submit_data("0",
                "Action=http://192.168.1.136:8083/manage/tsendtask/calTaskMoney2/2/0",
                "Method=POST",
                "EncType=multipart/form-data",
                "TargetFrame=",
                "RecContentType=text/html",
                "Referer=http://192.168.1.136:8083/manage/tsendtask/new",
                "Snapshot=t8.inf",
                "Mode=HTML",
                ITEMDATA,
                "Name=staskid", "Value=", ENDITEM,
                "Name=activityid", "Value=2", ENDITEM,
                "Name=vilidtimes", "Value=1", ENDITEM,
                "Name=sendmode", "Value=0", ENDITEM,
                "Name=sendnum", "Value=", ENDITEM,
                "Name=sfilename", "Value=", ENDITEM,
                "Name=starttimeString", "Value=2013-06-18 11:37:30", ENDITEM,
                "Name=type", "Value=1", ENDITEM,
                "Name=file", "Value=E:\\loadrunner\\mobile\\template2.txt", "File=Yes", ENDITEM,

        //"ContentType=text/html",  ENDITEM,
                "Name=mobile", "Value=", ENDITEM,
                "Name=customername", "Value=", ENDITEM,
                "Name=customersortnum", "Value=", ENDITEM,
                "Name=customer_radio", "Value=1", ENDITEM,
                "Name=customernum", "Value=-1", ENDITEM,
                LAST);

        lr_think_time(1000);

        web_submit_data("tsendtask",
                "Action=http://192.168.1.136:8083/manage/tsendtask",
                "Method=POST",
                "EncType=multipart/form-data",
                "TargetFrame=",
                "RecContentType=text/html",
                "Referer=http://192.168.1.136:8083/manage/tsendtask/new",
                "Snapshot=t9.inf",
                "Mode=HTML",
                ITEMDATA,
                "Name=staskid", "Value=", ENDITEM,
                "Name=activityid", "Value=2", ENDITEM,
                "Name=vilidtimes", "Value=1", ENDITEM,
                "Name=sendmode", "Value=0", ENDITEM,
                "Name=sendnum", "Value=2", ENDITEM,
                "Name=sfilename", "Value=20130618233754.txt", ENDITEM,
                "Name=starttimeString", "Value=2013-06-18 11:37:30", ENDITEM,
                "Name=type", "Value=1", ENDITEM,
                "Name=file", "Value=E:\\loadrunner\\mobile\\template2.txt", "File=Yes", ENDITEM,
                "Name=mobile", "Value=", ENDITEM,
                "Name=customername", "Value=", ENDITEM,
                "Name=customersortnum", "Value=", ENDITEM,
                "Name=customer_radio", "Value=1", ENDITEM,
                "Name=customernum", "Value=-1", ENDITEM,
                EXTRARES,
                "Url=../skins/newcss/images/card_bt.gif", "Referer=http://192.168.1.136:8083/manage/tsendtask?now=2013-06-18+23%3A37%3A55.876", ENDITEM,
                "Url=../skins/images/icon_flash_success.gif", "Referer=http://192.168.1.136:8083/manage/tsendtask?now=2013-06-18+23%3A37%3A55.876", ENDITEM,
                "Url=../skins/newcss/images/new_add.gif", "Referer=http://192.168.1.136:8083/manage/tsendtask?now=2013-06-18+23%3A37%3A55.876", ENDITEM,
                LAST);

        web_url("logout",
                "URL=http://192.168.1.136:8083/manage/login/logout",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t10.inf",
                "Mode=HTML",
                LAST);

        return 0;
}
作者: happylicong    时间: 2013-8-14 09:34
同求,关注中




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