|
本帖最后由 bob123654 于 2011-11-28 18:16 编辑
"目前只是把手工把链接输入到浏览器,查看返回结果" 这个只是做了功能测试,一般还用用LoadRunner对接口做压测,需要从开发那里知道url,每个参数的name,用web_submit_data()函数发送一次请求就可以了。
请参考一下脚本:
Action()
{
//对结果进行检查
web_reg_find("Search=Body", //定义查找范围
"SaveCount=result", //定义查找计数变量名称
"Text=<Code>0</Code>", //定义查找内容
LAST);
web_submit_data("Search",
"Action= http://10.240.248.103:7011/Service/Article/query.ashx?",
"Method=POST",
"Referer= http://10.240.248.103:7011/Service/Article/query.ashx?",
"Mode=HTML",
ITEMDATA,
"Name=method","Value=search",ENDITEM,
"Name=snsID","Value={mySnsID}",ENDITEM,
"Name=keyword","Value={myKeyword}",ENDITEM,
"Name=takeCount","Value=20",ENDITEM,
LAST);
//对检查结果进行判断
if (atoi(lr_eval_string("{result}")) > 0) //判断如果字符串出现次数大于0
lr_output_message("Log on successful."); //在日志中输出Log on successful
else
//如果出现次数小于等于
lr_error_message("Log on failed"); //在日志中输出Log on failed
return 0;
} |
|