Ask a Question

ReExecution Status is not getting Updated from test suite teardown

srikanth92
New Contributor

ReExecution Status is not getting Updated from test suite teardown

Hi Team, 

 

Greetings!!

 

I am running a test suite and in the tear down script am re-executing the failure test cases.

 

 

The issue is ,I am able to re-execute the failed test cases but the status of the test case are not getting updated even though testcase got passed on Re-Execution.

 

Please help me out in this how to update status of the failure testcase 

 

Thank You!!

7 REPLIES 7
Lucian
Community Hero

I think that if the test case fails once it will be considered as failed for the other runs also no matter what is the last result.

 

A solution would be to reset the status after the first run but I am not very sure if this is possible. Can you share the code that takes care of the re-execution?



If my answer helped please click on the 'Accept as Solution' button.

Hi Lucian,

 

 Following is the  code to re-execute the failure test cases,

 


for ( testCaseResult in runner.results )
{
testCaseName = testCaseResult.getTestCase().name
if ( testCaseResult.getStatus().toString() == "FAILED" )
{

testCaseResult.testCase.run(null, false)


}
}

 

Thank You!!

sanj
Super Contributor

This still does not solve the problem for the last test run.

test will still be flagged as a failure.

Thats what @Lucian had mentioned and I tend to agree.

 

Is there any other way to achieve??

I will look into it tonight and come with a response.


If my answer helped please click on the 'Accept as Solution' button.
Lucian
Community Hero

I've looked into the issue and didn't find any solutions. 

 

One of the problems in your script is that the API changed. Now the status is "FAIL" and "PASS" (and not "FAILED" and "PASSED" anymore).

 

On the other hand I tried to somehow discard the previous run results like:

 

def testStepResults = testCaseResult.getResults()
	for (def result : testStepResults)
		result.discard()

 But this didn't worked out. So I am not sure if this is possible. Smiley Sad



If my answer helped please click on the 'Accept as Solution' button.
TanyaYatskovska
SmartBear Alumni (Retired)

Hi,

 

@srikanth92, have the latest replies from @Lucian helped you? 

Could you please mark them as a solution if the question was resolved? This will help community members easier navigate to the solution.

 

Thanks!

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager



cancel
Showing results for 
Search instead for 
Did you mean: