@Target(value={METHOD,ANNOTATION_TYPE}) @Retention(value=RUNTIME) @ExtendWith(value=RepeatFailedTestExtension.class) @TestTemplate public @interface RepeatFailedTest
@RepeatFailedTest
is a JUnit Jupiter extension that repeats
a failing test a certain number of times before the test actually
shows up as failing.
If annotated with @RepeatFailedTest(n)
, a test method is
executed as long as it keeps failing, but no more than n
times. That means all actual executions - except possibly the
last - have failed. In contrast, all executions - except possibly
the last - show up as being ignored/aborted because that is the best
way to communicate a problem without breaking the test suite. Only
if all n
executions fail, is the last one marked as such.
Each ignored/aborted or failed execution includes the underlying
exception.
@RepeatFailedTest
has a number of limitations:
TestTemplate
-based mechanisms
like org.junit.jupiter.api.RepeatedTest @RepeatedTest
or
org.junit.jupiter.params.ParameterizedTest @ParameterizedTest
org.junit.jupiter.api.DynamicTest @DynamicTest
Modifier and Type | Required Element and Description |
---|---|
int |
value
Specifies how often the test is executed at most.
|