gradle / test-retry-gradle-plugin

Gradle plugin to retry tests that have failed to mitigate test flakiness.
Apache License 2.0
222 stars 50 forks source link

Verbose and time between retries #181

Closed oeresundsgruppen closed 5 months ago

oeresundsgruppen commented 1 year ago

Hi, retrying seems to work, but would like to see retry number 1, 2, 3 in logs.... Also can you add a wait-time between retries, possibly going up between each ?

marcphilipp commented 1 year ago

In which scenarios would a wait time help?

oeresundsgruppen commented 1 year ago

Likey exponential backoff is best algo - in any case, where some resources is overloaded, or slow to be available....

aluminais commented 7 months ago

I agree with oeresundsgruppen. Either exponential backoff or time between retries would help for my case. Which is an external resource that can be slow to become available after it fails. Hammering it too quickly can make things worse.

The tests are highly business critical, but the testing environment has stringent constraints enforced by some vendors.

pshevche commented 5 months ago

For a more descriptive visualization of retries, we recommend using Gradle Build Scans: https://scans.gradle.com/. They provide more details for each retry attempt. Here is an [example](https://ge.junit.org/s/tcwmbmjybjktg/tests/task/:junit-jupiter-engine:test/details/org.junit.jupiter.engine.extension.TimeoutExtensionTests$SeparateThread/oneThreadStuckForeverAndOtherTestsInSameThread()?top-execution=1) for how a flaky test in the JUnit codebase is visualized. There you can see all iterations in the order they were run with corresponding failure and output.

As for the wait time between retries, we talked about it internally and decided that this should not be part of this plugin. Ideally, you would have some "health check" in the setup of your tests that starts the tests only once this piece of infrastructure is available and healthy. The wait time between retries does not seem like a reliable solution to all problems.