Forum Discussion

madnan486's avatar
madnan486
Occasional Visitor
9 years ago

Groovy Script Test Step only execute once in a DataSource Loop test case

Hi,

I am new to Ready!API and created a test case with datasource loop. I've added a groovy script which checks one property of the response of an earlier step. If the property value is 'Inprogress' then it waits and excute the same step again. My problem is the groovy script only get run once.

Basically I want to wait and keep executing the 'avalability response' step till it's status property is no longer 'InProgress'. If there is a better way of doing it please let me know.

def response = context.expand( '${XXYYZZ')
if (response == "InProgress")
{
sleep(5000)
testRunner.runTestStepByName( "Availability Response")
}

Many Thanks

1 Reply

  • abhishek8908's avatar
    abhishek8908
    Occasional Contributor

    Hi ,

     

    May be you can try the same with conditional goto step.

     

    In the conditional goto provide the Xpath of the reponse text on which you want to take the actions.

    eg.

    //ns1:Response[1]/ns1:statusCode[1]/text()='Inprogess'

    in the target step you give the name of your first step("Availability Search").Let me know its works for you or not.

     

     

    Thanks,

    Abhishek