使用模拟用户运行,脚本自动停止,数据已成功插入到数据库
本帖最后由 激流勇进 于 2014-12-27 17:59 编辑脚本如下,用户注册,已使用参数化,脚本回放运行正常,数据成功进入到数据库,但使用械拟用户操作脚本,若不限制时间,脚本无限制运行,若限定运行时间,则到时间后直接停止,不知道为什么不显示成功
Action()
{
web_add_cookie("rememberMe=KichFaIIAz8+VvOX+vOKfkGwYUHsJhKdcjjh426VHYfcdzVL5AGY37Gh7/mtVs/RgI03mzrX1IyQ5f6XedhXQz5faP0X+cHxWqMhwvfhC9e0/1E7s/tJ9iXzG5w4VIjtGV+lp5G+E32q94sfLQAuiSrwc4IxlZDNVcrIMjb/nXmkfv0EE9izWM/Z/bw5ZSMwGYD+Zj/haHVwdFdErv63S7CqtFj5PfjZXQ+DlVABhOEUC8uoAI6hyd3xMgtIg882/x2xs1Y0quPRa6idY6YA9wXt20HYtb0cK+YCoNhjnrYRu9jLU89WNu/ufCrfiqgK/5Rb+Z/wZLBa8LYXaPXzgrlv80t3s7u5d4uRKr3ohOYSs+/h9mxPEj0JwZeBB0jnqSZhN+75h5IFvGln0yljjaGDh9OL2Dneuz7RAKooTvWuJfR2a4VjdRsa+ZexXT9yH5ph/"
"qWoVEvyq6OMdDIyzXy6tHEr0Yadk7XUPT8AHIXfDNZb4qk8h1v7Mh7r8XzvTJfKrmleuMz+jV5lVq+WQHQTd6LIlveypzQ3xbe5D834m/RkLFOjujO0Q4AFoG4w/hOlw9G5eZZJHofPCMIvwCXE22i5Y97IY9VmGC/6G1CFhuQ/pa6alWqYQsVJfZfVikggYKg5vj7wD2Cj1XKDHZ3FLnA9HpC9yWu0VUMqgWtcxQWncj/lYk+p4Ri8CGnzP8d34K2qxJ6GMBunPQP1jhKHa4LfXP4oCZZpV8icBWocW6ht1aH8Bv4YUaZNVqVxP0gvh4dfp0Rq4LUt3ndqgg==; DOMAIN=192.168.168.170");
web_url("192.168.168.170:8080",
"URL=http://192.168.168.170:8080/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t53.inf",
"Mode=HTML",
EXTRARES,
"Url=/resource/public/images/zhuye-img_01.gif", ENDITEM,
"Url=/resource/public/images/nav_pic.png", ENDITEM,
"Url=/resource/public/images/ggwsydl.png", ENDITEM,
"Url=/resource/public/images/111.png", ENDITEM,
"Url=/resource/public/images/zhuye-img_04.png", ENDITEM,
"Url=/resource/public/images/jianbian.png", ENDITEM,
"Url=/resource/public/images/dl.png", ENDITEM,
"Url=/resource/public/images/zc.png", ENDITEM,
"Url=/resource/public/images/zhuye-img_12.png", ENDITEM,
"Url=/resource/public/images/zhizuo-_01.png", ENDITEM,
LAST);
lr_think_time(34);
web_url("personalReg.jhtml",
"URL=http://192.168.168.170:8080/personalReg.jhtml",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t54.inf",
"Mode=HTML",
LAST);
lr_think_time(11);
lr_start_transaction("submit19");
web_submit_data("ajaxComValidReg.jhtml",
"Action=http://192.168.168.170:8080/ajaxComValidReg.jhtml",
"Method=POST",
"RecContentType=text/html",
"Referer=http://192.168.168.170:8080/personalReg.jhtml",
"Snapshot=t55.inf",
"Mode=HTML",
ITEMDATA,
"Name=loginName", "Value={loginname19}", ENDITEM,
"Name=idcard", "Value=", ENDITEM,
"Name=password", "Value=", ENDITEM,
"Name=comfirmPwd", "Value=", ENDITEM,
"Name=trueName", "Value=", ENDITEM,
"Name=phoneNum", "Value=", ENDITEM,
"Name=email", "Value=", ENDITEM,
"Name=sex", "Value=woman", ENDITEM,
"Name=submit", "Value=nosubmit", ENDITEM,
LAST);
web_submit_data("ajaxComValidReg.jhtml_2",
"Action=http://192.168.168.170:8080/ajaxComValidReg.jhtml",
"Method=POST",
"RecContentType=text/html",
"Referer=http://192.168.168.170:8080/personalReg.jhtml",
"Snapshot=t56.inf",
"Mode=HTML",
ITEMDATA,
"Name=loginName", "Value={loginname19}", ENDITEM,
"Name=idcard", "Value=", ENDITEM,
"Name=password", "Value=111111", ENDITEM,
"Name=comfirmPwd", "Value=", ENDITEM,
"Name=trueName", "Value=", ENDITEM,
"Name=phoneNum", "Value=", ENDITEM,
"Name=email", "Value=", ENDITEM,
"Name=sex", "Value=woman", ENDITEM,
"Name=submit", "Value=nosubmit", ENDITEM,
LAST);
web_submit_data("ajaxComValidReg.jhtml_3",
"Action=http://192.168.168.170:8080/ajaxComValidReg.jhtml",
"Method=POST",
"RecContentType=text/html",
"Referer=http://192.168.168.170:8080/personalReg.jhtml",
"Snapshot=t57.inf",
"Mode=HTML",
ITEMDATA,
"Name=loginName", "Value={loginname19}", ENDITEM,
"Name=idcard", "Value=", ENDITEM,
"Name=password", "Value=111111", ENDITEM,
"Name=comfirmPwd", "Value=111111", ENDITEM,
"Name=trueName", "Value=", ENDITEM,
"Name=phoneNum", "Value=", ENDITEM,
"Name=email", "Value=", ENDITEM,
"Name=sex", "Value=woman", ENDITEM,
"Name=submit", "Value=nosubmit", ENDITEM,
LAST);
lr_think_time(12);
web_submit_data("ajaxComValidReg.jhtml_4",
"Action=http://192.168.168.170:8080/ajaxComValidReg.jhtml",
"Method=POST",
"RecContentType=text/html",
"Referer=http://192.168.168.170:8080/personalReg.jhtml",
"Snapshot=t58.inf",
"Mode=HTML",
ITEMDATA,
"Name=loginName", "Value={loginname19}", ENDITEM,
"Name=idcard", "Value=", ENDITEM,
"Name=password", "Value=111111", ENDITEM,
"Name=comfirmPwd", "Value=111111", ENDITEM,
"Name=trueName", "Value=方茴19", ENDITEM,
"Name=phoneNum", "Value=", ENDITEM,
"Name=email", "Value=", ENDITEM,
"Name=sex", "Value=woman", ENDITEM,
"Name=submit", "Value=nosubmit", ENDITEM,
LAST);
lr_think_time(22);
web_submit_data("ajaxComValidReg.jhtml_5",
"Action=http://192.168.168.170:8080/ajaxComValidReg.jhtml",
"Method=POST",
"RecContentType=text/html",
"Referer=http://192.168.168.170:8080/personalReg.jhtml",
"Snapshot=t59.inf",
"Mode=HTML",
ITEMDATA,
"Name=loginName", "Value={loginname19}", ENDITEM,
"Name=idcard", "Value=", ENDITEM,
"Name=password", "Value=111111", ENDITEM,
"Name=comfirmPwd", "Value=111111", ENDITEM,
"Name=trueName", "Value=方茴19", ENDITEM,
"Name=phoneNum", "Value=15872982589", ENDITEM,
"Name=email", "Value=", ENDITEM,
"Name=sex", "Value=woman", ENDITEM,
"Name=submit", "Value=nosubmit", ENDITEM,
LAST);
lr_think_time(9);
web_submit_data("ajaxComValidReg.jhtml_6",
"Action=http://192.168.168.170:8080/ajaxComValidReg.jhtml",
"Method=POST",
"RecContentType=text/html",
"Referer=http://192.168.168.170:8080/personalReg.jhtml",
"Snapshot=t60.inf",
"Mode=HTML",
ITEMDATA,
"Name=loginName", "Value={loginname19}", ENDITEM,
"Name=idcard", "Value=", ENDITEM,
"Name=password", "Value=111111", ENDITEM,
"Name=comfirmPwd", "Value=111111", ENDITEM,
"Name=trueName", "Value=方茴19", ENDITEM,
"Name=phoneNum", "Value=15872982589", ENDITEM,
"Name=email", "Value=", ENDITEM,
"Name=sex", "Value=woman", ENDITEM,
"Name=submit", "Value=nosubmit", ENDITEM,
LAST);
lr_think_time(9);
web_submit_data("ajaxComValidReg.jhtml_7",
"Action=http://192.168.168.170:8080/ajaxComValidReg.jhtml",
"Method=POST",
"RecContentType=text/html",
"Referer=http://192.168.168.170:8080/personalReg.jhtml",
"Snapshot=t61.inf",
"Mode=HTML",
"EncodeAtSign=YES",
ITEMDATA,
"Name=loginName", "Value={loginname19}", ENDITEM,
"Name=idcard", "Value=", ENDITEM,
"Name=password", "Value=111111", ENDITEM,
"Name=comfirmPwd", "Value=111111", ENDITEM,
"Name=trueName", "Value=方茴19", ENDITEM,
"Name=phoneNum", "Value=15872982589", ENDITEM,
"Name=email", "Value=123@123.com", ENDITEM,
"Name=sex", "Value=man", ENDITEM,
"Name=submit", "Value=submit", ENDITEM,
LAST);
lr_rendezvous("submitjhd19");
lr_end_transaction("submit19", LR_AUTO);
web_submit_data("192.168.168.170:8080_2",
"Action=http://192.168.168.170:8080/",
"Method=POST",
"RecContentType=text/html",
"Referer=http://192.168.168.170:8080/personalReg.jhtml",
"Snapshot=t62.inf",
"Mode=HTML",
ITEMDATA,
"Name=loginName", "Value={loginname19}", ENDITEM,
"Name=password", "Value=111111", ENDITEM,
"Name=trueName", "Value=方茴19", ENDITEM,
"Name=idcard", "Value=", ENDITEM,
"Name=sex", "Value=man", ENDITEM,
EXTRARES,
"Url=/resource/public/images/tc.png", ENDITEM,
"Url=/resource/public/images/ggw-yhdlh.png", ENDITEM,
LAST);
return 0;
}
:L没看明白问题是什么 :lol嗯,在题问方面还有待提高。问题是脚本为什么自动停止运行,没有一条执行成功,同时并发8个用户,共写入8条数据,有3条已成功插入数据库。想知道如何让该脚本运行结果为pass 印象流:如果设定了持续时间,则结束后状态为stop。如果设定了循环次数,则结束后的状态为pass。
如果设定了持续时间,则到了时间就会自动停止运行;
看你的脚本里有8个web_submit_data,内容都差不多,你说的8个用户不会是指这个吧?
还有,你脚本里的集合点的位置好奇怪啊。
1、那个脚本是我测试用户注册功能录制的脚本,因登录名唯一,所以将登录名参数化了,其它的地方都没有改动。至于8个web_submit_data我也不太明白,内容差不多,我试过把那几个都合并到1个里面但回放脚本时失败了。
2、做性能测试时我如何辨别测试数据的正确性,会不会因为脚本不正确而导至结果不正确呢。
3、我很想在测试工具上有突破,我正在学习这本书《loadRunner性能测试实战》,按照书上操作总会出现这那的问题,不知道团长有没有好的方法及学习工具。
页:
[1]