Rerun Failed Test Cases

Applies to ReadyAPI 3.5, last modified on January 19, 2021

You can use Groovy scripts to run test cases.

This topic describes how to use a test suite-level teardown script to check for failed test cases and rerun them.

Where To Use



import com.eviware.soapui.model.testsuite.TestRunner.Status

//Rerun failed test cases X amount of times based off the number set in the RerunCount test suite property
def reRunCount = Integer.parseInt(testSuite.getPropertyValue("RerunCount"))
def failTestSuite = false
for ( testCaseResult in runner.results ) {
  if ( testCaseResult.getStatus().toString() == 'FAIL' ){
    def tRun
    for (i = 0; i < reRunCount; i++) {
      tRun =, false) //Need to have "true" as the second argument"Run..." + testCaseResult.getTestCase().name)
      if(tRun.getStatus().toString() == "PASS"){
        runner.status = Status.FINISHED //Change test suite status to PASS
    if(tRun.getStatus().toString() == "FAILED")
      failTestSuite = true //If a test case is still failed after reruns, set the flag to fail the test suite and exit the loop

  runner.status = Status.FAILED //Change the test suite status to failed if the flag is set to fail the test suite

See Also

Groovy Scripts

Highlight search results