question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IRetryAnalyzer is broken

See original GitHub issue

I 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 in org.testng.TestNG calls m_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:closed
  • Created 9 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
nmiroshnichenkocommented, Oct 7, 2015

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”

0reactions
juherrcommented, Nov 23, 2015

@rschmitt Is #698 fixing this issue or do you want to keep it open for any reason?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found