Posted by: devakara on: September 30, 2008
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.
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!
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.
Hi Lali,
Here is what I’ve understand by your explanation that you’re importing ‘client ids’ from a text file to ‘Properties’ step using groovy script and now you want to use them in the ‘request’, right?
So all you have to do is,
Write the name of the properties test step you’ve used followed by $ sign, #clientId (its the name of the variable you’ve used in the properties step for client ID), here is an example:
${Properties#clientId}
Also, sequence of test steps is important, Groovy Script, Properties and then Test Request and so on ….
Hope it helps,
Regards,
Zuhaib Ahmed
Hi Devakara,
I am using Soapui Pro and I am a fresher to it. I want to do parameterization. I want to take input values from an excel file for two parameters in my soap request. I am trying to use datasource step in this scenario. However, I am not sure I have to use Properties in this case or not. Do I need groovy script in this case or not.
Also need to know the exact procedure for Properties and Properties transfer along with its significance?
Thanks,
Tanuj
December 2, 2008 at 7:32 pm
Hi devakara,
I am a fresher to SOAP UI. I found your blog about Groovy scripting very useful.
I am currently stuck with Parameterization.
I need to dynamically take input value for param called ‘Client id’ which should be a valid one already present in the system.
I have set of Valid client Id’s and I imported them from text file through Groovy script, I created the property called ‘Client id’ and did property transfer.
Now I want to make the request to take the new input value for each run.how can i do that?
Thanks,
Lali