Annotation Type RepeatedTest
-
@Target({ANNOTATION_TYPE,METHOD}) @Retention(RUNTIME) @Documented @API(status=STABLE, since="5.0") @TestTemplate public @interface RepeatedTest
@RepeatedTestis used to signal that the annotated method is a test template method that should be repeated a specified number of times with a configurable display name.Each invocation of the repeated test behaves like the execution of a regular
@Testmethod with full support for the same lifecycle callbacks and extensions. In addition, the current repetition and total number of repetitions can be accessed by having theRepetitionInfoinjected.@RepeatedTestmethods must not beprivateorstaticand must returnvoid.@RepeatedTestmethods may optionally declare parameters to be resolved byParameterResolvers.@RepeatedTestmay also be used as a meta-annotation in order to create a custom composed annotation that inherits the semantics of@RepeatedTest.- Since:
- 5.0
- See Also:
DisplayName,RepetitionInfo,TestTemplate,TestInfo,Test
-
-
Field Summary
Fields Modifier and Type Fields Description static StringCURRENT_REPETITION_PLACEHOLDERPlaceholder for the current repetition count of a@RepeatedTestmethod:{currentRepetition}static StringDISPLAY_NAME_PLACEHOLDERstatic StringLONG_DISPLAY_NAMELong display name pattern for a repeated test: "{displayName} :: repetition {currentRepetition} of {totalRepetitions}"static StringSHORT_DISPLAY_NAMEShort display name pattern for a repeated test: "repetition {currentRepetition} of {totalRepetitions}"static StringTOTAL_REPETITIONS_PLACEHOLDERPlaceholder for the total number of repetitions of a@RepeatedTestmethod:{totalRepetitions}
-
Required Element Summary
Required Elements Modifier and Type Required Element Description intvalueThe number of repetitions.
-
-
-
Field Detail
-
DISPLAY_NAME_PLACEHOLDER
static final String DISPLAY_NAME_PLACEHOLDER
-
-
-
CURRENT_REPETITION_PLACEHOLDER
static final String CURRENT_REPETITION_PLACEHOLDER
Placeholder for the current repetition count of a@RepeatedTestmethod:{currentRepetition}
-
-
-
TOTAL_REPETITIONS_PLACEHOLDER
static final String TOTAL_REPETITIONS_PLACEHOLDER
Placeholder for the total number of repetitions of a@RepeatedTestmethod:{totalRepetitions}
-
-
-
SHORT_DISPLAY_NAME
static final String SHORT_DISPLAY_NAME
Short display name pattern for a repeated test: "repetition {currentRepetition} of {totalRepetitions}"
-
-
-
LONG_DISPLAY_NAME
static final String LONG_DISPLAY_NAME
Long display name pattern for a repeated test: "{displayName} :: repetition {currentRepetition} of {totalRepetitions}"- See Also:
DISPLAY_NAME_PLACEHOLDER,SHORT_DISPLAY_NAME
-
-
-
name
String name
The display name for each repetition of the repeated test.Supported placeholders
Defaults to
SHORT_DISPLAY_NAME, resulting in names such as"repetition 1 of 2","repetition 2 of 2", etc.Can be set to
, resulting in names such asLONG_DISPLAY_NAME"myRepeatedTest() :: repetition 1 of 2","myRepeatedTest() :: repetition 2 of 2", etc.Alternatively, you can provide a custom display name, optionally using the aforementioned placeholders.
- Returns:
- a custom display name; never blank or consisting solely of whitespace
- See Also:
SHORT_DISPLAY_NAME,LONG_DISPLAY_NAME,DISPLAY_NAME_PLACEHOLDER,CURRENT_REPETITION_PLACEHOLDER,TOTAL_REPETITIONS_PLACEHOLDER,TestInfo.getDisplayName()
- Default:
- "repetition {currentRepetition} of {totalRepetitions}"
-
-