Rerun Failed Test Cases

Applies to ReadyAPI 3.53, last modified on June 07, 2024

You can use Groovy scripts 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 Scripting Samples

Highlight search results