All about SOAP UI and Groovy in it

Posts tagged ‘variable parameter in SOAP request’

load testing with SOAP request having variable parameter(s)

 

At times there could be requirement of Load Testing a Web Service following different strategies based on the requirement.

But say if there are fields in the SOAP request which are supposed to be unique for every request that hits the service while load testing…really this could be tough to deal with.

With the new feature called in line scripting of SOAP UI 2.5, this could achieved with ease. 

For example, lets say we have a web service deployed on a server. And the service writes report files to the server’s file system, with the name having some unique value derived from the SOAP request.

 

Sample GenReportXml for the above service

Sample GenReportXml for the above service

 

We have a node called RefNum having value 123456 in the above request, using which the service writes a report to the file system with name say Report_123456.txt. Every time a request with some RefNum triggers the service to generate a report file, one hindrance would be the RefNum of every request that hits the servicve should be unique, to have a valid file in the local system.(weird web service right!.. i understand…just take it as an example).

Issue now would be to load test such service, which demands some unique value in the SOAP request evrey time it hits it.  In SOAP UI 2.5 we have a very simple solution for such weirdly complicated services, called in-line scripting!
 

SOAP request with in line groovy script

SOAP request with in line groovy script

 

In the above request, under RefNum node I included a Groovy Step to fetch the current time in milliseconds. The notation ${=…} is the next level of Property Expansion technique. The ‘=’ shall evaluate the script and provide the result as that nodes’ value.

This serves the purpose of Load Testing the service, providing unique RefNums for every request, no matter what strategy we follow to in testing, without doing any work around at the application level…(which sounds great!).

The above example seems to be explicitly specific, but I hope it would be usefull. There are still lot of ways we can explore the cool in line Groovy scripting feature , which the SOAP UI’s new version has got along.

 

(Please feel free to get back if u hav any trouble…as i’m just a mail away..leave a comment otherwise)