Annotation Type CartesianTest
@CartesianTest
is a JUnit Jupiter extension that marks
a test to be executed with all possible input combinations.
Methods annotated with this annotation should not be annotated with Test
.
This annotation is somewhat similar to @ParameterizedTest
, as in it also takes
arguments and can run the same test multiple times. With @CartesianTest
you
don't specify the test cases themselves, though. Instead you specify possible values for
each test method parameter (for example with @CartesianTest.Values
) by annotating the parameters
themselves and the extension runs the method with each possible combination.
You can specify a custom Display Name for the tests ran by @CartesianTest
.
By default it's [{index}] {arguments}.
For more details and examples, see
the documentation on @CartesianTest
.
- Since:
- 1.5.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interface
Parameter annotation to be used withCartesianTest
for providing enum values.static @interface
Points to a method to provide parameter values for aCartesianTest
.static @interface
Parameter annotation to be used withCartesianTest
for providing simple values. -
Optional Element Summary
Optional Elements -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Placeholder for the complete, comma-separated arguments list of the current invocation of a@CartesianTest
method:{arguments}
static final String
Placeholder for the display name of a@CartesianTest
static final String
Placeholder for the current invocation index of a@CartesianTest
method (1-based):{index}
-
Field Details
-
DISPLAY_NAME_PLACEHOLDER
Placeholder for the display name of a@CartesianTest
- Since:
- 1.5
- See Also:
-
INDEX_PLACEHOLDER
Placeholder for the current invocation index of a@CartesianTest
method (1-based):{index}
- Since:
- 1.5
- See Also:
-
ARGUMENTS_PLACEHOLDER
Placeholder for the complete, comma-separated arguments list of the current invocation of a@CartesianTest
method:{arguments}
- Since:
- 1.5
- See Also:
-
-
Element Details
-
name
String nameThe display name to be used for individual invocations of the parameterized test; never blank or consisting solely of whitespace.
Defaults to
ParameterizedTest.DEFAULT_DISPLAY_NAME
.Supported placeholders:
-
ParameterizedTest.DISPLAY_NAME_PLACEHOLDER
-ParameterizedTest.INDEX_PLACEHOLDER
-ParameterizedTest.ARGUMENTS_PLACEHOLDER
-{0}
,{1}
, etc.: an individual argument (0-based)For the latter, you may use
MessageFormat
patterns to customize formatting.- See Also:
- Default:
- "[{index}] {arguments}"
-