Forum Discussion

moustafa's avatar
moustafa
New Contributor
8 years ago

I had this code, on the latest update, it's not working anymore

This loop used to work to verify my step has passed before it moves to the next step. It also tries only five times before it fails the test and moves on. But after I've updated my ReadAPI, it's not even working, the test just moves on to the next step, even when I have failed steps.

 

Can you guys tell me what's changed?

 

def lastResult = testRunner.getResults().last()
def lastResultName = lastResult.getTestStep().getLabel().toString()
def lastResultStatus = lastResult.getStatus().toString()
def j = context.expand( '${#TestCase#LoopLimiter}' ).toInteger()

 

log.info 'Test Step [' + lastResultName + '] status: ' + lastResultStatus

if (lastResultStatus == 'FAILED' && j < 5)
{
myGotoStepName = 'GTRReRun'
log.info 'Goto step [' + myGotoStepName + ']'
testRunner.gotoStepByName( myGotoStepName )
j = (j + 1).toString()
testRunner.testCase.setPropertyValue("LoopLimiter", j)
}

else
{
j = 0
log.info 'Continue to next step'
}

No RepliesBe the first to reply