Using GroovyScript in SoapUI to access and lock an external file

775 views Asked by At

I have a set of 60 testcases in a project in SoapUI that I want to run concurrently. Each testcase needs to use a value to work. The values are stored in an external file (spreadsheet or textfile). Each testcase needs to get a value from this file and use it. However when I run the testsuite, multiple tests are picking up the same value however only one value can be used for a test (same value cannot be used in more than 1 test at the same time). I would like the external file to be accessed by one testcase at a time in soapUI. Does this involve locking or some sort of queueing system or what groovyscript could I use? thanks

1

There are 1 answers

0
ArianJafari On

I can't figure out how to get this to work with your external file, but I can think of another way only using SoapUI. Here's my suggestion for a solution:

  1. Create a new TestCase containing only a DataGen TestStep.
  2. Configure it so that it generates the numbers you want.
  3. Change its mode to "READ", so that it will generate a new value every time the test step is run.
  4. Now, wherever you want one of these values, instead of accessing your external file, add a Run TestCase TestStep to run your new DataGen test case, and make sure to return the generated number as a property. Use it where you need the generated number.

As I'm typing this, I just realized this only works with the pro version of SoapUI. If you don't have a license you can get a trial from the website.