lr直接点击创建脚本,然后在action中编写代码,即可。
具体脚本如下所示:
Action()
{
int status;
lr_start_transaction("send");
web_reg_find("Search=All", //检查点函数的设置
"SaveCount=ret_Count", //查找的参数保存的名字
"Text=ahbei",
LAST);
status=web_url("usermsg",
"URL= http://bubbler.labs.douban.com/j/user/ahbei", //要进行测试的接口
"TargetFrame=Main",
"Resource=0",
"RecContentType=text/html",
"Mode=http",
LAST );
lr_output_message("Request Status:%d",status);
lr_output_message("查找到的返回值个数:%d",atoi(lr_eval_string("{ret_Count}")));
if (atoi(lr_eval_string("{ret_Count}")) > 0){//这里判断检查到的个数
lr_output_message("Rec successful.");
lr_end_transaction("send", LR_PASS);
}
else{
lr_error_message("Rec failed");
lr_end_transaction("send", LR_FAIL);
}
return 0;
}