Pages

Search Term:
Your Ad Here
Your Ad Here

Tuesday, December 28, 2010

Web service Performance Testing using Load Runner

Web service performance testing can do two ways using the Loadrunner.

1.If client provides a Wsdl URL we will use web service protocol and record.

Select the web service protocol from the protocol list and click on create.(refer the screen shot)


Click on Manage service in the lodrunner and click on Import


Click on Import on Manage service window enter URL (wsdl) and click on Import.



Click on Apply and OK on Manage service window.



Click on Add Service Call on Load runner window, and select the methods from the Operations list


Select the objects which we are including in the web service call and give the value



And the sample code below.


Action()
{

char name[10];
int temparature;

lr_start_transaction("FirstWebservice");


web_service_call( "StepName=GetCitiesByCountry_101",
"SOAPMethod=GlobalWeather|GlobalWeatherSoap|GetCitiesByCountry",
"ResponseParam=response",
"Service=GlobalWeather",
"ExpectedResponse=SoapResult",
"Snapshot=t1291533619.inf",
BEGIN_ARGUMENTS,
"CountryName=INDIA",
END_ARGUMENTS,
BEGIN_RESULT,
END_RESULT,
LAST);

lr_xml_get_values("XML={response}",
"ValueParam=OutputParam",
"Query=//Body/GetCitiesByCountryResponse/GetCitiesByCountryResult",
LAST);

lr_xml_get_values("XML={OutputParam}",
"ValueParam=OutputParam1",
"Query=//NewDataSet/Table/City",
"SelectAll=yes",
LAST);

sprintf(name,"{OutputParam1_%d}",5);

lr_save_string(lr_eval_string(name),"name1");

lr_output_message ("The new file name is %s", lr_eval_string("{name1}"));


lr_end_transaction("FirstWebservice",LR_AUTO);



lr_start_transaction("Cityname");

web_service_call( "StepName=GetWeather_101",
"SOAPMethod=GlobalWeather|GlobalWeatherSoap|GetWeather",
"ResponseParam=response1",
"Service=GlobalWeather",
"ExpectedResponse=SoapResult",
"Snapshot=t1291533100.inf",
BEGIN_ARGUMENTS,
"CityName={name1}",
"CountryName=INDIA",
END_ARGUMENTS,
BEGIN_RESULT,
END_RESULT,
LAST);

lr_xml_get_values("XML={response1}",
"ValueParam=OutputParam11",
"Query=//Body/GetWeatherResponse/GetWeatherResult",
LAST);

lr_xml_get_values("XML={OutputParam11}",
"ValueParam=OutputParam111",
"Query=//CurrentWeather/Temperature",
LAST);

lr_output_message("City temparature %s",lr_eval_string("{OutputParam111}"));

temparature=lr_xml_find("XML={OutputParam11}",
"Query=//CurrentWeather/Temperature",LAST);

if (temparature>0) {

lr_end_transaction("Cityname",LR_PASS);
}
else
{
lr_end_transaction("Cityname",LR_FAIL);

return 0;
}

1 comment:

  1. I do the same process but got Compilation error. why ?
    Message is "Cannot start replay due to compilation errors"

    ReplyDelete

Search

Your Ad Here