Forum Discussion

headphonebounty's avatar
New Contributor
4 years ago

Multi Thread a Loop in a Groovy Script that calls another test case



I have a project set up with one test suite, and two test cases within them. One test case contains a number of test steps that contain various assertions based on the response message from a REST response and what it should contain. The request message in this test case has several variables which are set by calling a properties table.


Separately, the second test case contains a Groovy script, which is designed to run through the first test case a number of times. In this script I have various lists of data. The script then cycles through each list, and amends the variables in the first testcases properties, each amendment being a separate run of the first testcase.


This is all done within a loop. The problem is that this means each test is run sequentially which is not efficient. Is there a better way to do this? The loop is set up like so -


for(int NumCycle = 0;NumCycle<2;NumCycle++){  (Ifs that amends some variables)

                                   for (X in Variables){

runner =, true);


(then all my bits to log out the results of each assertion on each step)




So when I press play on the Groovy script, I'm able to loop through twice and amend the variables to what I need them to be for each run. This all works, but is slow because its one request/response per loop. Anyway to resolve?


Thanks in advance!

1 Reply

  • ZDGN's avatar

    Hi headphonebounty 


    If I look back what I've already try to do with SoapUI, I would say no.

    Let me explain: once I tried to do some similar thing and what hurts is that updating variables can lead to change previous or future execution, resulting in similar cases.

    What you're excepting is to do some kind of multithreading or asynchrone executions.

    In both cases, you should consider doing this only with code.

    And to go further, may be not even with SoapUI (don't know if Groovy is the best langage for doing this).


    Tell us what you think about and what choice you'll make.