-
@TestTemplate @ExtendWith(CartesianTestExtension.class) @Target(METHOD) @Retention(RUNTIME) public @interface CartesianTest
@CartesianTestis 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@CartesianTestyou 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
-
-
Field Summary
Fields Modifier and Type Fields Description static java.lang.StringARGUMENTS_PLACEHOLDERPlaceholder for the complete, comma-separated arguments list of the current invocation of a@CartesianTestmethod:{arguments}static java.lang.StringDISPLAY_NAME_PLACEHOLDERPlaceholder for the display name of a@CartesianTest:{displayName}static java.lang.StringINDEX_PLACEHOLDERPlaceholder for the current invocation index of a@CartesianTestmethod (1-based):{index}
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description java.lang.StringnameThe display name to be used for individual invocations of the parameterized test; never blank or consisting solely of whitespace.
-
-
-
Field Detail
-
DISPLAY_NAME_PLACEHOLDER
static final java.lang.String DISPLAY_NAME_PLACEHOLDER
Placeholder for the display name of a@CartesianTest:{displayName}- Since:
- 1.5
- See Also:
name()
-
-
-
INDEX_PLACEHOLDER
static final java.lang.String INDEX_PLACEHOLDER
Placeholder for the current invocation index of a@CartesianTestmethod (1-based):{index}- Since:
- 1.5
- See Also:
name()
-
-
-
ARGUMENTS_PLACEHOLDER
static final java.lang.String ARGUMENTS_PLACEHOLDER
Placeholder for the complete, comma-separated arguments list of the current invocation of a@CartesianTestmethod:{arguments}- Since:
- 1.5
- See Also:
name()
-
-
Element Detail
-
name
java.lang.String name
The display name to be used for individual invocations of the parameterized test; never blank or consisting solely of whitespace.Defaults to [{index}] {arguments}.
Supported placeholders:
DISPLAY_NAME_PLACEHOLDERINDEX_PLACEHOLDERARGUMENTS_PLACEHOLDER{0},{1}, etc.: an individual argument (0-based)
For the latter, you may use
MessageFormatpatterns to customize formatting.- Since:
- 1.5
- See Also:
MessageFormat,ParameterizedTest.name()
- Default:
- "[{index}] {arguments}"
-
-