Forum Discussion

API_Guy's avatar
API_Guy
Occasional Contributor
4 years ago
Solved

Retry a test case 3 times before it marks failed

Hi There, I am very new to SOAP UI Pro and I have test cases that has 22 test steps in a single test case, starting from login to book a ticket in an application.  I am trying to make this test dyn...
  • aaronpliu's avatar
    aaronpliu
    4 years ago

    Simple solution:

    Retrieve target test case running status, if failed, then rerun.

     

    import com.eviware.soapui.support.types.StringToObjectMap
    
    //
    def testcase = testRunner.testCase.testSuite.testCases["TargetTestCaseName"]
    def testresult = testcase.run(new StringToObjectMap(), false)
    
    // loop
    for (i in 0..<3) {
        if (testresult.status.toString() == 'FAIL') {
            testresult = testcase.run(new StringToObjectMap(), false)
        } else {
            break
        }  
    }