Improve `@RetryingTest`: offer suspend attribute or similar to configure pauses between reruns
See original GitHub issueRelated to #355
User should be able to specify a “cooldown” period between failed test re-runs. Example:
@RetryingTest(value = 3, suspendForMs = 1000)
void test() {
Assertions.fail(); // should wait 1 second (1000 ms) between runs
}
Alternatives/additions:
@RetryingTest(value = 3, suspend = 1, suspendUnit = ChronoUnit.SECONDS)
void test() {
Assertions.fail(); // should wait 1 second (1000 ms) between runs
}
Adding other suspend modes, e.g.: RANDOM
, to wait a random amount of time between 0 and suspend
.
@RetryingTest(value = 3, suspend = 1000, suspendUnit = ChronoUnit.MILLIS, suspendMode = SuspendMode.RANDOM)
void test() {
Assertions.fail(); // should wait between 0-1 second (0-1000 ms) between runs
}
Alternative:
@RetryingTest(value = 3, suspendForMs = 1000, suspendForMsFactor = 400)
void test() {
Assertions.fail(); // should wait 1-1.4 second (1000-1400 ms) between runs
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Move Rerunner-Jupiter/improve RetryingTest? #355 - GitHub
offer suspend -like attribute to configure pauses between reruns; offer minSuccess -like attribute to configure how often a test has to pass in...
Read more >Retrying Failing Tests - JUnit Pioneer
The suspendForMs attribute specifies the amount of time to pause between retries, in milliseconds. The thread executing this test is sleeping during that...
Read more >python retry with tenacity, disable `wait` for unittest
The function uses the tenacity wait -argument to wait some time in between calls. The function together with the @retry -decorator seems to...
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 FreeTop 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
Top GitHub Comments
When test depends on external resource (eg. web service) and project is developed by many developers, run on many ci systems it can happen that test from each environment will retry in the some similar time.
Of course I think about some of IT, system tests - unit test shouldn’t depends on external resources.
Hey @mathieufortin01, thanks for offering to contribute. 👍🏾 You can definitely give it a go. I’m not 100% sure what would be the best way to implement this, so I recommend to start with a proof of concept (basic implementation and a few demos/tests to demonstrate) without polish (no documentation, tests don’t need to assert anything if that turns out to be complicated) and open a draft PR with that, so we can take a look.
On your two points:
suspendForMs
.PS: We’re not always timely with out replies to issues and PRs, so best prepare for that. 😊