testing interface Performance with LoadRunner
Method One: Call the interface through the WSDL address
1. Open LoadRunner click on the upper left corner select New script, select the Web service protocol in the pop-up window, then click the Create button
2.Click Manager Services(Note: The cursor of the front right window script must be preceded by "return();"), click in the pop-up window Import, in the Pop-up window select "URL" and fill in the address to test the interface corresponding to the address after adding "? wsdl, and then click Import
3, the import URL will be successful after the corresponding information appears, and then click "OK"
4. Click "Add servicecall" and select the method to test in thepop-up window opertion the corresponding drop-down list, select Import on the left Arguments, and then enter the corresponding request in the value on the right (also can be entered casually, the following can be modified in the script).
5.select out on the left side of the window , then tick "Save returned ..." on the right. ", in parameter the corresponding content can be modified, can remain unchanged, is actually a variable, used to store the output value.
6, after the completion of the above operation automatically generated the following script, marked Red place for just the random input of the request content, now with a legitimate request to replace
7, in the script to replace the content of the request after debugging the script to see if there is an error, if the script is normal, then the design of the running scenario, the subsequent load testing work.
Method Two: Import the XML file
Let's look at the request content of the corresponding interface given by the developer below:
{
"Sysid": "1",
"UserName": "Root",
"PassWord": "root321",
"Queryarray": [
{
"Fltnum": "QW9977",
"Fltdate": "2014-04-12",
"Orig": "SZX"
}
]
}
As shown above, the request we get from the developer is in JS format, not in XML format, and we'll try it again at the same time:
1, import in the script paste on our request found ":", "}" and so on did not turn blue, but black display, which indicates that these content is loadrunner Unrecognized, Let's run it. There are also many log reports in the log, what is the reason? Because loadrunner scripts follow the syntax rules of the C language, and these symbols are defined in the C language, We want to use an escape character that must be added to escape them. It is too cumbersome to modify one by one, so we introduce The second method of using the LoadRunner Test interface: Importing the XML file method.
2, add js request in SoapUI, debug script to see whether through
3, script debugging through the Save script as an XML file
4.Click Import SOAPand click "... "button to select just from SoapUI save it in the XML file
5, then the contents of the window is more, paste in the URL to test the interface corresponding link,SOAP action and developers to communicate to see if there is a corresponding Action , there is no need to fill out,Response paramenter corresponding content to fill in,
is to define a stored variable for the content of the service response.
6, through the above operation Click OK after the following script, after running through, we can continue to follow the performance test work.
Let's take a closer look at the changes in the script in both cases:
Paste the requested script directly after the interface is called:
Action ()
{
Web_service_call ("stepname=gettotalpassandtotalacpassandtotalluagg_102",
"Soapmethod=flightinfoandvippassinfoquerywebservice| Flightinfoandvippassinfoquerywebservicehttpport|
Gettotalpassandtotalacpassandtotalluagg ",
"Responseparam=response",
"Service=flightinfoandvippassinfoquerywebservice",
"Expectedresponse=soapresult",
"Snapshot=t1405582936.inf",
Begin_arguments,
"In0={
"Sysid": "1",
"UserName": "Root",
"PassWord": "root321",
"Queryarray": [
{
"Fltnum": "QW9977",
"Fltdate": "2014-04-12",
"Orig": "SZX"
}
]
}",
End_arguments,
Begin_result,
End_result,
last);
return 0;
}
Script generated after importing the XML file:
Action ()
{
Soap_request ("Stepname=soap request",
"URL=HTTP://192.168.0.125:8090/QWSIS/SERVICES/FLIGHTINFOANDVIPPASSINFOQUERYWEBSERVICE?WSDL",
"Soapenvelope="
"<soapenv:envelope xmlns:soapenv=\" http://schemas.xmlsoap.org/soap/envelope/\ "xmlns:web=
\ "Http://webservice.sasis.com\" > "
"<soapenv:Header></soapenv:Header>"
"<soapenv:Body>"
"<web:getPassengerMobiles>"
"<web:in0>"
" {"
"\" sysid\ ": \" 1\ ","
"\" username\ ": \" Root\ ","
"\" password\ ": \" root321\ ","
"\" queryarray\ ": ["
" {"
"\" fltnum\ ": \" Qw9977\ ","
"\" fltdate\ ": \" 2014-04-12\ ","
"\" orig\ ": \" Szx\ ""
" }"
" ]"
"}"
"</web:in0>"
"</web:getPassengerMobiles>"
"</soapenv:Body>"
"</soapenv:Envelope>",
"Soapaction=",
"Responseparam=response",
"Snapshot=t1405565685.inf",
last);
return 0;
}
We will find that the second case of the script uses "" to process the request "{", "[", "" "and"\"to escape processing, After processing, the contents of the script are recognized and changed to a blue font display.
LoadRunner Testing WebService Interface Performance