Annotation Type CartesianTest


@TestTemplate @ExtendWith(org.junitpioneer.jupiter.cartesian.CartesianTestExtension.class) @Target(METHOD) @Retention(RUNTIME) public @interface 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 Classes
    Modifier and Type
    Class
    Description
    static @interface 
    Parameter annotation to be used with CartesianTest for providing enum values.
    static @interface 
    Points to a method to provide parameter values for a CartesianTest.
    static @interface 
    Parameter annotation to be used with CartesianTest for providing simple values.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The display name to be used for individual invocations of the parameterized test; never blank or consisting solely of whitespace.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static 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}