51Testing软件测试论坛
标题:
如何使用自定义检查点
[打印本页]
作者:
huangjian198663
时间:
2011-7-14 16:59
标题:
如何使用自定义检查点
如果我自定义一个检查点规则: (在Vuser--Runtime Settings--ContentCheck 里面设置)
1、Fail if 选择: found
输出: 登录失败
2、Fail if 选择:not found
输出:登录成功
代码具体如下
Action()
{
int ireturn =1;
web_custom_request("login.php",
"URL=http://count.pw08.iciba.com/login.php?info=ZmlsZW5hbWU9uci46L3wyb20yrDUus/X97DmMjAwOC5leGUmbWFjPUQ0NkQ5OTI5OEZEODQ2NjQ5ODREOEY4RDZCMjAxMEIzJnBhc3Nwb3J0PTEuOTUmdmVyc2lvbj0yMDA5LjguMTIuMTYzJnV1aWQyPSZpZWFkZGluPTE=&verify=884e4c8af62e610dd0cc2a50a99bec0d",
"Method=GET",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Mode=HTTP",
"EncType=application/octet-stream",
"Body=info=ZmlsZW5hbWU9uci46L3wyb20yrDUus/X97DmMjAwOC5leGUmbWFjPUQ0NkQ5OTI5OEZEODQ2NjQ5ODREOEY4RDZCMjAxMEIzJnBhc3Nwb3J0PTEuOTUmdmVyc2lvbj0yMDA5LjguMTIuMTYzJnV1aWQyPSZpZWFkZGluPTE=&verify=884e4c8af62e610dd0cc2a50a99bec0d",
LAST);
web_url("WebTours",
"URL=http://127.0.0.1:1080/WebTours/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTTP",
LAST);
web_concurrent_start(NULL);
web_url("header.html",
"URL=http://127.0.0.1:1080/WebTours/header.html",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/WebTours/",
"Snapshot=t2.inf",
"Mode=HTTP",
LAST);
web_url("welcome.pl",
"URL=http://127.0.0.1:1080/WebTours/welcome.pl?signOff=true",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/WebTours/",
"Snapshot=t3.inf",
"Mode=HTTP",
LAST);
web_concurrent_end(NULL);
web_concurrent_start(NULL);
web_url("webtours.png",
"URL=http://127.0.0.1:1080/WebTours/images/webtours.png",
"Resource=1",
"RecContentType=image/png",
"Referer=http://127.0.0.1:1080/WebTours/header.html",
"Snapshot=t4.inf",
LAST);
web_url("hp_logo.png",
"URL=http://127.0.0.1:1080/WebTours/images/hp_logo.png",
"Resource=1",
"RecContentType=image/png",
"Referer=http://127.0.0.1:1080/WebTours/header.html",
"Snapshot=t5.inf",
LAST);
web_concurrent_end(NULL);
web_concurrent_start(NULL);
web_url("home.html",
"URL=http://127.0.0.1:1080/WebTours/home.html",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/WebTours/welcome.pl?signOff=true",
"Snapshot=t6.inf",
"Mode=HTTP",
LAST);
web_url("nav.pl",
"URL=http://127.0.0.1:1080/WebTours/nav.pl?in=home",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/WebTours/welcome.pl?signOff=true",
"Snapshot=t7.inf",
"Mode=HTTP",
LAST);
web_concurrent_end(NULL);
web_url("mer_login.gif",
"URL=http://127.0.0.1:1080/WebTours/images/mer_login.gif",
"Resource=1",
"RecContentType=image/gif",
"Referer=http://127.0.0.1:1080/WebTours/nav.pl?in=home",
"Snapshot=t8.inf",
LAST);
lr_think_time(5);
web_submit_data("login.pl",
"Action=http://127.0.0.1:1080/WebTours/login.pl",
"Method=POST",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/WebTours/nav.pl?in=home",
"Snapshot=t9.inf",
"Mode=HTTP",
ITEMDATA,
"Name=userSession", "Value=106166.982584042ftzAQztpVzzzzzzHDcHzfpHif", ENDITEM,
"Name=username", "Value=jojo", ENDITEM,
"Name=password", "Value=bean", ENDITEM,
"Name=JSFormSubmit", "Value=off", ENDITEM,
"Name=login.x", "Value=22", ENDITEM,
"Name=login.y", "Value=11", ENDITEM,
LAST);
web_concurrent_start(NULL);
web_url("nav.pl_2",
"URL=http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/WebTours/login.pl",
"Snapshot=t10.inf",
"Mode=HTTP",
LAST);
web_url("login.pl_2",
"URL=http://127.0.0.1:1080/WebTours/login.pl?intro=true",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/WebTours/login.pl",
"Snapshot=t15.inf",
"Mode=HTTP",
LAST);
web_concurrent_end(NULL);
web_concurrent_start(NULL);
web_url("flights.gif",
"URL=http://127.0.0.1:1080/WebTours/images/flights.gif",
"Resource=1",
"RecContentType=image/gif",
"Referer=http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home",
"Snapshot=t11.inf",
LAST);
web_url("itinerary.gif",
"URL=http://127.0.0.1:1080/WebTours/images/itinerary.gif",
"Resource=1",
"RecContentType=image/gif",
"Referer=http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home",
"Snapshot=t12.inf",
LAST);
web_url("in_home.gif",
"URL=http://127.0.0.1:1080/WebTours/images/in_home.gif",
"Resource=1",
"RecContentType=image/gif",
"Referer=http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home",
"Snapshot=t13.inf",
LAST);
web_url("signoff.gif",
"URL=http://127.0.0.1:1080/WebTours/images/signoff.gif",
"Resource=1",
"RecContentType=image/gif",
"Referer=http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home",
"Snapshot=t14.inf",
LAST);
web_concurrent_end(NULL);
if(ireturn == 0 ){
lr_output_message("登录成功,ireturn = %d", ireturn);
}
else{
lr_error_message("登录失败,iretun = %d", ireturn);
}
return 0;
}
作者:
msnshow
时间:
2011-7-14 21:49
不对吧
作者:
huangjian198663
时间:
2011-7-15 09:18
回复
2#
msnshow
一、
1、 在Vuser里面可以设置自动检查点,但是用的话好像不行呀, 代码可以用上面的
2、在(Vuser--Runtime Settings--ContentCheck )设置好检查点
3、录制好脚本后,在(Vuser--Runtime Settings--ContentCheck )中选中使用检查点
4、运行脚本,检查点功能没有
二、手动添加检查点,我用了可以,但是自动的却用不了???
作者:
msnshow
时间:
2011-7-16 09:02
你定义的 int ireturn =1;
怎么后面判断是否=0 ,这个变量的值又没改变
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2