-
Notifications
You must be signed in to change notification settings - Fork 258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Retry failed tests automatically #658
Comments
I want to share my experience about test failing sometimes without reasons (aka flaky tests), and how I and my team solved it.
But as users using the library to test, we did not expect anything more from What we did back then to avoid the flaky tests:
So IMO, |
But another opinion is that, we also went through the time where the product features expanded so fast and the team didn't have enough time to look into each failed test to resolve them all, our CI failed from time to time and everyone went with "just rerun the test pipeline!!!" or flag it as Retry failed tests seem to be a valid request as well, just for the sake of having an ability to mark something is flaky and not too error prone, and then the team can work on them when they have time 😄 |
hi @vearutop I'd like to work on this issue, do you have any concerns? |
The topic of retries is a bit broad. There is an accepted proposal for Go in this area: golang/go#62244 (comment). I'm not sure what would be the most useful implementation in our domain. I see a few ways with this.
When A must pass
And B must pass
And if further steps fail, retry up to 5 times
And C should pass
And D should pass
And E must pass Here Such strategy could potentially be implemented with something like
@flaky
Scenario: passing mine field
When I move ahead
Then I stay alive From test suite maintenance complexity this seems like the explicit statement above. But precision and control are less. Though,
These strategies do not conflict with each other and could potentially even co-exist, but probably it would be best to have just "one good way" of tackling the issue. @nhv96 what do you think should be the implementation strategy (and please share if you have other ideas for it)? |
So the accepted retry flag is that you pass a variable into the CLI arg (i.e. 2), and then it will retry "each" test case up to that many times. The result of a test case is the least worst result (Noting once you have a pass then you are fine). Ruby has a separate unique binding that has a max cap on retries (But this shouldn't be seen as the standard bearer and has been rejected by other flavours). TL;DR - retry is a common flag used in most flavours of cucumber and is part of the compatibility-kit |
@vearutop Thank you for pointing me to the Go discussion, it is very insightful. My initial approach was to add a global flag in The idea with explicit statements in This leaves the other 2 options: using If I can only chose one, I'd prefer the using of Also, I believe this approach |
Makes sense to me, please proceed with this if you have capacity. |
🤔 What's the problem you're trying to solve?
It is always frustrating when the test fails with no reason and just works fine with a retry. It is common to fail one or other test when there are thousands of tests running in parallel. There can be multiple reasons for failure like network slowness, overloaded server.
✨ What's your proposed solution?
It would be really helpful if we have a feature to rerun the failed tests.
Rerun option is also provided by other tools for example
ctest -> https://cmake.org/cmake/help/v3.17/manual/ctest.1.html ( --repeat until-pass:n )
maven-surefire-plugin -> https://maven.apache.org/surefire/maven-surefire-plugin/examples/rerun-failing-tests.html
I have also seen in here cucumber-rs/cucumber#212
It would be really helpful, if you consider this. Thank you :)
⛏ Have you considered any alternatives or workarounds?
No response
📚 Any additional context?
No response
The text was updated successfully, but these errors were encountered: