vendredi 21 février 2020

Choose a value at random from a list, then use this value in a SOAP Request TestStep

I have a short list of values: [Option_1, Option_2, Option_3].

For each loop of my test, I want to pick a value from this list at random and assign it to a variable that I can then use in a Soap test step.

I've got a Groovy Script TestStep:

def z = ["Option_1", "Option_2", "Option_3"]
Random rnd = new Random()

def option = z[rnd.nextInt(z.size)]

testRunner.testCase.setPropertyValue( "selectedOption", option )

In my Soap Test Step, I attempt to call the variable like so:

<value>${#selectedOption}</value>

Am I even close here? I'm extremely new to both SoapUI and Groovy. Any help would be much appreciated.




Aucun commentaire:

Enregistrer un commentaire