skip test step using groovy
I have a test where I need to iterate through the response to validate several values.
If the values match I want to goto a "pass" test step but if they fail I want to go to a different "fail" test step.
if (responseCategory != expectedCategory){
log.info("Test Failed")
testRunner.gotoStepByName("Test Case - FAIL")
}
else{
log.info("Test Passed")
testRunner.gotoStepByName("Test Case - PASS")
}
The "Test Case - "FAIL" is followed by this script:
testRunner.fail("Result not as expected!")
This is used to abort the test on a fail condition.
After the testRunner.fail there is the "Test Case - "PASS" test step followed by the dataSource loop.
However, the test allows follows the fail path regardless of the if/else result. I can watch the logs and they will log the "Test Passed" yet the "Test Case - "FAIL" test step will run instead of the "Test Case - "PASS" test step.
What am I missing here? My understanding was that the gotoStepByName was programmatically the same as the condition goto test step. I've used the condition goto test step on other test cases and it worked in this same set up.
Thanks,
Billy