Description
It would be great to have a JUnit 5 annotation that allows repeating entire test cases. E.g. using @RepeatedTest
at every test method does not achieve quite the same as parameterized tests in JUnit 4 - the order of repeated tests changes.
Repeating entire test cases is useful when e.g. reproducing concurrency problems observed in tests. Repeating single methods n
times one after the other might not be sufficient to reproduce such problems. E.g. if test1()
starts a concurrent task that affects test2()
, it might not be trivial to discover this problem when repeating test1()
n
times and then repeating test2()
also n
times. But repeating test1()
, test2()
, test1()
, test2()
, test1()
, test2()
... n
times might uncover the issue quickly.
See my initial question on how to repeat an entire test case here: #4608
@marcphilipp provided a working solution with JUnit 5.13 - it would be great if this solution can be a part of JUnit 5. So that JUnit 5 users don't need to redefine this code based on @ClassTemplate
.
If its too much maintenance effort, it would nevertheless be nice to have this solution documented as an example.