LoadRunner测试Webservices的脚本例子:
Action()
{
web_service_call( "StepName=Add_101",
"SOAPMethod=Service|ServiceSoap|Add",
"ResponseParam=response",
"Service=Service",
"ExpectedResponse=SoapResult",
"Snapshot=t1307948103.inf",
BEGIN_ARGUMENTS,
"a=1",
"b=2",
END_ARGUMENTS,
BEGIN_RESULT,
"AddResult=Param_AddResult",
END_RESULT,
LAST);
//lr_output_message(lr_eval_string("{Param_AddResult}"));
//lr_output_message(lr_eval_string("{response}"));
lr_xml_extract("XML={response}",
"XMLFragmentParam=Result",
"Query=/soap:Envelope/soap:Body/AddResponse/AddResult", LAST );
lr_output_message(lr_eval_string("{Result}"));
return 0;
}
注:LoadRunner测试Webservice的方法在《性能测试与调优实战》视频教程中有详细介绍。