'How can I retry a parameterized test on JUnit 5?

I have a flaky parameterized test that I want to retry a couple of times if it fails before actually saying fail when the test runs. There is good reason for the flakiness (it has to do with concurrency and small chance race conditions which does not overall affect the system) so no I don't need to remove the flakiness.

In JUnit 4 we could set up rules in which I set up a sort of "Retry rule" that retries the test x number of times before failing. However, in JUnit 5 that's gone and the only solutions I've seen so far involve normal JUnit 5 tests and not parameterized tests. What's the best way to retry a parameterized test in JUnit 5?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source