|
本帖最后由 redhat_liu 于 2013-7-9 13:01 编辑
我写的接口测试脚步如下: 大概的思路就是 发请求,通过两个检查点来判断是否存在接口异常的情况。
我最有疑问就是后面的if else 嵌套,不知道那么写对不对,请XDJM们指点下,小D 在此谢过!
lr_start_transaction("GETPNINFOS");
web_reg_find("Search=All",
"SaveCount=ZTE_COUNT",
"Text=Connection reset",
LAST);
web_reg_find("Search=All",
"SaveCount=ZTE_COUNT1",
"Text=Read timed out",
LAST);
web_service_call( "StepName=getPnInfos_101",
"SOAPMethod=OSSInterfaceForCRMService|OSSInterfaceForCRMPort|getPnInfos",
"ResponseParam=response",
"Service=OSSInterfaceForCRMService",
"ExpectedResponse=SoapResult",
"Snapshot=t1373340562.inf",
BEGIN_ARGUMENTS,
"inXml={NewParam}",
END_ARGUMENTS,
BEGIN_RESULT,
"return=Param_return",
END_RESULT,
LAST);
//输出调用返回值
lr_log_message("result1111111112222 = %s", lr_eval_string("{Param_return}"));
if (atoi(lr_eval_string("{ZTE_COUNT}"))>0) //验证是否找到了要检查的字符串
lr_end_transaction("GETPNINFOS",LR_FAIL);
else
{
if (atoi(lr_eval_string("{ZTE_COUNT1}"))>0)
{
lr_end_transaction("GETPNINFOS",LR_FAIL);
}
else
lr_end_transaction("GETPNINFOS",LR_PASS);
}
lr_think_time(3); |
|