51Testing软件测试论坛
标题:
如何使用for循环多次执行同一请求,
[打印本页]
作者:
zhangdizhu
时间:
2015-4-17 17:52
标题:
如何使用for循环多次执行同一请求,
int i;
Action()
for(i=1;i<=10;i++){
web_reg_find("Fail=NotFound",
"Search=Body",
"SaveCount=num",
"Text=AAAAyA",
LAST);
web_custom_request("projectmanager_20",
"URL=http://192.168.2.22/services/projectmanager",
"Method=POST",
"Resource=0",
"RecContentType=text/xml",
"Referer=",
"Snapshot=t82.inf",
"Mode=HTTP",
"EncType=text/xml; charset=utf-8; action=\"\"",
"Body=<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"
http://schemas.xmlsoap.org/soap/envelope/\
" xmlns:SOAP-ENC=
\"
http://schemas.xmlsoap.org/soap/encoding/\
" xmlns:xsi=\"
http://www.w3.org/2001/XMLSchema-instance\
" xmlns:xsd=
\"
http://www.w3.org/2001/XMLSchema\
" xmlns:ns2=\"
http://bean.lubansoft.com\
" xmlns:ns3=\"
http://po.lubansoft.com\
" xmlns:ns1=
\"webhadoop\"><SOAP-ENV:Body><ns1:executeCommand><ns1:in0>query progress</ns1:in0><ns1:in1>{floorid}
</ns1:in1></ns1:executeCommand></SOAP-ENV:Body></SOAP-ENV:Envelope>",
LAST);
// lr_output_message(lr_eval_string("{num}"));
if(atoi(lr_eval_string("{num}"))>0)
lr_output_message("碰撞完成");
break;
else
lr_output_message("继续碰撞");
}
return 0;
}
Action.c(380): Error -26366: "Text=AAAAyA" not found for web_reg_find [MsgId: MERR-26366]
Action.c(380): Notify: Saving Parameter "num = 0".
Action.c(380): web_custom_request("projectmanager_20") highest severity level was "ERROR", 314 body bytes, 161 header bytes [MsgId: MMSG-26388]
Action.c(380): Notify: Transaction "开始" ended with "Fail" status (Duration: 2.4077 Wasted Time: 0.0029).
为什么上面的代码没有执行输出message的语句,
需求是,循环发送相同的请求,直到服务器返回正确的状态吗,从而跳出循环
但是为什么没有进行循环呢??
给指点下哪里出问题了吗??
作者:
zhangdizhu
时间:
2015-4-18 08:40
把web_reg_find函数里面的 "Fail=NotFound"这个去掉就可以了,
作者:
saharaqs
时间:
2015-4-18 09:49
web_custom_request("projectmanager_20") 这个出错了,没走到循环那里就结束了。
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2