|
录制脚本后添加了这个web_reg_find()函数,查找页面上某段字符串(user是登陆的用户名,页面登陆成功后会显示这个用户名),reply的时候没有问题,但是在并发测试的时候就会有好多事务报错Log on failed,但是为什么reply的时候没有问题呢?在网上查资料说是在并发较大的时候,服务器还没来得返回请求的字符串有可能loadrunner已经进行下一步操作了,所以找不到,把应用部署在处理速度较快的机子上,测试时就没有出现这个问题。
现在我们的服务器资源没那么多,请问我要怎么改写脚本才能解决这个问题呢,求高手指教,急。。。。
web_reg_find("Search=Noresource",
"Text={user}",
"SaveCount=loginresult",
LAST);
web_submit_form("logon.do_2",
"Snapshot=t2.inf",
ITEMDATA,
"Name=siteLanguage", "Value=中文", ENDITEM,
"Name=loginId", "Value={user}", ENDITEM,
"Name=loginPassword", "Value={pwd}", ENDITEM,
EXTRARES,
"Url=sysMenu.do", ENDITEM,
"Url=js-lib/ext/resources/images/default/tabs/tab-strip-bg.gif", ENDITEM,
"Url=js-lib/ext/resources/images/default/tabs/tabs-sprite.gif", ENDITEM,
"Url=js-lib/ext/resources/images/default/s.gif", ENDITEM,
"Url=js-lib/ext/resources/images/default/toolbar/bg.gif", ENDITEM,
"Url=skin/default/images/icon_house.png", ENDITEM,
"Url=js-lib/ext/resources/images/default/toolbar/btn-arrow.gif", ENDITEM,
"Url=js-lib/ext/resources/images/default/grid/grid-blue-split.gif", ENDITEM,
"Url=skin/default/images/icon_door_out.png", ENDITEM,
"Url=js-lib/ext/resources/images/default/toolbar/tb-btn-sprite.gif", ENDITEM,
"Url=js-lib/ext/resources/images/default/qtip/tip-sprite.gif", ENDITEM,
LAST);
web_url("loadView.do",
"URL=http://192.168.2.15:8081/pms2/loadView.do?viewName=/home.html",
"Resource=0",
"RecContentType=text/html",
"Referer=http://192.168.2.15:8081/pms2/logon.do",
"Snapshot=t3.inf",
"Mode=HTML",
LAST);
lr_think_time(10);
if(atoi(lr_eval_string("{loginresult}"))>0)
{
lr_output_message("login successful!");
}
else
{
lr_error_message("Log on failed");
}
lr_end_transaction("Login",LR_AUTO); |
|