0

I would like to automatically replay my JUnit 5 tests when they fail.

With JUnit 4, I was using Rule with public class Retry implements TestRule like here: How to Re-run failed JUnit tests immediately?

This solution worked for me, it applied to all tests without having to put an annotation on each test. And on the test reports only the last test instance was kept.

Is there an equivalent on JUnit5?

I tried with the @RepeatedIfExceptionsTest(repeats = 2) annotation, but it has to be put on every test. And for test reports it's not ideal, it looks like there are more tests. You should only keep the last instance.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
El barto
  • 19
  • 4
  • Assuming you are using an IDE there has to be a button somewhere that does that. – assylias Jan 25 '22 at 11:40
  • I think you didn't understand my problem ;) I want to automatically retry the test that failed as indicated in the link I quoted. – El barto Feb 01 '22 at 16:26
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Feb 03 '22 at 08:54

0 Answers0