I'm using the IRetryAnalyzer class in TestNG in order to relaunch tests that fail (up to 5 attempts). Right now if I run a test and it fails three times before passing, it says:
Tests run: 4, Failures: 3, Errors 0, Skipped 0.
What I want the results to show is:
Tests run: 1, Failures: 0, Errors 0, Skipped 0.
Basically, I don't want it to count as a failure unless it fails all 5 reruns. How do I do this?
since nobody replied, i give it a try.
just random thoughts i had when reading your post, while i was searching for a solution for my problem...
you can get the result of your test in your @AfterTest
method via ITestResult result
@AfterMethod
public void AfterMethod_CheckForFailure(ITestResult result, Method m)
an @AfterMethod
is called when a method with @Test
annotation has finished.
able to read the current iteration from a static
class with a static
member
and if its <5
then use
result.setStatus(ITestResult.SUCCESS); // or what ever status you want
setCurrentTestResult(result);
dunno if that works, but looks to me it could :) Good luck