Ask a Question

Load Test from java with WsdlLoadTest Class

pratoa
Occasional Contributor

Load Test from java with WsdlLoadTest Class

Hi,

 

In my SoapUI I have my TestSuite with its TestCase. The TestCase has a REST endpoint as TestStep. The REST endpoint gets its unique values from the TestCase properties, as such, ${#TestCase#memberId}. In my java code, I create a LoadTest inside the TestCase. And then I create a Groovy script as a second TestStep, that when I run the LoadTest is supposed to run before the REST endpoint. This Groovy script gets memberId's from the Database and assigns the value to the TestCase property "memberId" so that when the REST endpoint is called it will get the memberId from there. 

 

So, when I run my LoadTest with limit type of runs per thread the Groovy script is not ran but until the 3rd run. Since the script is not being run, the property "memberId" of the TestCase is not being changed and the REST endpoint is being called with an empty memberId, therefore returning a 404. In the 3rd run, the script does run and the REST endpoint is called with different "memberId's" for each thread or virtual user.

 

Is there anyway I can force the LoadTest to run the Groovy script every time? I don't know why SoapUI is doing this, but there has to be a way to solve this. 

 

Thank you in advance!

2 REPLIES 2
nmrao
Community Hero

Re: Load Test from java with WsdlLoadTest Class

Not clear or confused with lengthy description.

Would you mind showing the code snippet and where you think in the code could be a problem?


Regards,
Rao.
pratoa
Occasional Contributor

Re: Load Test from java with WsdlLoadTest Class

Hi nmrao,

 

I added a snippet of my class LoadTest.

So, the issue is that when I create a loadTest with my class and then make it run, I have to make it run 3 times so that the REST endpoint uses unique ID's. As you can see I add a Groovy script as a TestStep to the TestCase, which is supposed to run before the REST endpoint so that the ID's are all unique. I managed to go around this and make it work, but I have to make the loadTest run two more times than it should. 

You can see in this if, I basically say if the limitType is Runs per Threads (which is what I need) add 2 to the testLimit. So, if i want to make it run one time, I have to actually run it 3 times to make the ID's unique.

 

if (limitType == 3){
testLimit = testLimit + 2;

 

Thank you, and let me know if need any more information or to clear things up more!

 

-Andres

Screen Shot 2017-04-07 at 12.19.46 PM.png

cancel
Showing results for 
Search instead for 
Did you mean: