Forum Discussion

cr3ddy's avatar
16 years ago

Conditional goto step using properties

Folks,

Can anyone tell me how to do conditional goto step based on a property value.

For example I have a property called 'count'.  I need to repeat SOAP calls 'count' number of times.
I am looking for a way to implement this by decrementing the value of count each time the call is made, and then stepping out of the loop when 'count' is zero.

Appreciate any help.
Thanks
CReddy.
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hello,

    You need to use a Groovy script TestStep for this. For instance to use a property that is located in the TestCase, you could use this:


    def count = Integer.parseInt(testRunner.testCase.properties['count'].value)
    testRunner.testCase.properties['count'].value = --count

    if(count > 0)
    testRunner.gotoStep(testRunner.testCase.getTestStepIndexByName('YourTestStep'))


    Regards,
    Dain
    eviware support