IRetryAnalyzer is broken
See original GitHub issueI tend to use a lot of TestNG’s more advanced features for integration testing, and I’d really like to be able to use IRetryAnalyzer
with inherently non-deterministic tests that can fail spuriously. Unfortunately that feature appears to be fundamentally broken because of how it was integrated with TestNG’s various callback APIs:
- The Reporter(s) will be notified of each
FAILED
invocation attempt, even if the test method ultimately succeeds - Similarly, the
ExitCodeListener
inorg.testng.TestNG
callsm_mainRunner.setStatus(FAILED)
as soon as a test invocation fails (the test method’s ultimate success does not matter), so TestNG will exit with a nonzero exit code (resulting in, for instance, the overall Ant or Maven task failing), even if you use one of the hacks intended to fix the test report
I’m only aware of two ways around these fundamental deficiencies: reflection hacks to mutate the internal state of the TestNG
instance, or writing a custom test runner to replace it.
I’m willing to do the design and coding work to fix this issue, but first I want to make sure everyone agrees with my statement of the problem.
Issue Analytics
- State:
- Created 9 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Retry Failed Test in TestNG with IRetryAnalyzer
In this article, we will learn how to retry failed test in TestNG with IRetryAnalyzer and also how to rerun all tests from...
Read more >TestNG retry mechanism was broken if launching tests with ...
I have written a code for retrying a failed test case using TestNG retry mechanism. If I ran the tests directly, the retry...
Read more >Retry failed tests is not working in TestNg 7.0.0?
If I run the tests on the version testng 7.0.0 , then the dropped tests aren't restarted. public class RetryAnalyzer implements IRetryAnalyzer { ......
Read more >How to Retry Failed Tests in TestNG Automation Framework
public interface IRetryAnalyzer { /** * Returns true if the test method has to be retried, false otherwise. * * @param result The...
Read more >Retrying failed test at class level using @Listner not working
I am trying to use IRetryAnalyzer for retrying test at class level. @Test(retryAnalyzer=Retry.class) dint work at class level so tried the alternate ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
And I think “failures-to-be-retried” should be reported (with some “non-final-failure-status”), user can ignore such status, but other users wish to track such non-final-failures. For example, we log such failures as ordinary failures (with stack traces and screenshots) with just a little (but clearly visible) addition to the message like “ERROR: Test class.method(params) failed but WILL BE RETRIED”
@rschmitt Is #698 fixing this issue or do you want to keep it open for any reason?