Forum Discussion
- User999Contributor
Hey Richie,
So sometimes a test step fails intermittently within my Test Case and I want an automate re-run/retry the whole test case again from the start.
I've tried adding a TearDown Script within the Test Case but goes on an infinite loop and I just want it to retry 2 or 3 times then if still fails on retry stop it...
import com.eviware.soapui.support.types.StringToObjectMap
// Retrieve target test case running status, if failed, then rerun.
def testcase = testRunner.testCase.testSuite.testCases["Contract_Created"]
def testresult = testcase.run(new StringToObjectMap(), false)// loop
for (int i=0; i<3; i++) {
if (testresult.status.toString() == 'FAIL') {
testresult = testcase.run(new StringToObjectMap(), false)
} else {
break
}
}- richieCommunity HeroHey User999,
Did you take your code from another post on the soapui forum?
I noticed there was a post by aaronpliu and your code is IDENTICAL, excepting your for clause.
aaronplui's response to this included (i in 0..<3) in his for clause. Whereas yours is (int i=0; i<3; i++).
Tbh, i wouldve thought your code wouldve worked fine,but anyway, try changing the code and see what happens.
Ta
Rich
Related Content
- 5 years ago
- 3 years ago
Recent Discussions
- 6 days ago