Forum Discussion

Saurabh17's avatar
Saurabh17
New Contributor
2 years ago

ReRun only Fail test steps in SoapUI Groovy script .

Hi All ,
Need urgent help ,I am new to SoapUI I need to rerun failed steps using groovy script . I tried with below code but getting "Error java.lang.NumberFormatException: null jerror at line: 2" . Can some one help with the solution please .

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("3"))
for ( testCaseResult in runner.results ) {
/*
* Dans SoapUI les statuts sont FINISHED ou FAILED
* Dans ReadyAPI, les statuts sont PASS ou FAIL
*/
if ( testCaseResult.getStatus().toString() == 'FAIL' || testCaseResult.getStatus().toString() == 'FAILED' ) {
def tRun
for (i = 0; i < reRunCount; i++) {
tRun = testCaseResult.testCase.run(null, false) //Need to have "true" as the second argument
log.info("Run..." + testCaseResult.getTestCase().name)

if(tRun.getStatus().toString() == "PASS"){
runner.status = Status.FINISHED //Change test suite status to PASS
break;
}
}
}
}

 

 

No RepliesBe the first to reply