Ask a Question

retry failed testCase

yassir
Occasional Contributor

retry failed testCase

i am facing an issue that should be easy to implement but somehow i can not find an answer anywhere, the goal is to retry failed test cases 3 times before mark the test Case as failed.

 

we have few pro version licenses just in case the solution requires the readyapi pro version.

 

5 REPLIES 5
prashobkt
Contributor

@yassir

 

create a groovy script:

 

if(testRun < 3)

{

 

testRunner.gotoStepByName("StepName")

 

}

/T3D
yassir
Occasional Contributor

@prashobkt thank you very much for your input. i was able to get this to work by using below code but now after i was able to get test case to rerun i am facing another issue to set status to Finished instead of Failed.

the rerun is passing but test case still showing failed in result. i am using testCaseResult.setStatus but it doesnt seem to work so far

 

 

for ( testCaseResult in runner.results ) {

              testCaseName = testCaseResult.getTestCase().name

              log.info testCaseName

 

              if ( testCaseResult.getStatus().toString() == 'FAILED' )

                             {

                                           log.info "$testCaseName has failed"

 

                                           for (i = 0; i <3; i++) {

 

                                                          testCaseResult.testCase.run(null, false)

                                           }

 

                             }

}

 

@yassir

 

I would suggest to use a custom property to store and write the test case result.

/T3D
yassir
Occasional Contributor

@prashobkt

could you please share some more details on how to do this.

as per smartbear technical support, they say that there is no way to do this (below email is from them)

 

Hi,

 

Unfortunately, the testCase status is evaluated based on each step ran, so even if the step is passing later the status will be failed.

 

We have a reported this issue number is SOAP-4820.

 

Thanks

@yassir

 

Write a script to check the assertions and set a custom property to Pass/Fail.

 

 

/T3D
cancel
Showing results for 
Search instead for 
Did you mean: