Annotation Interface ParameterizedTest

@Target({ANNOTATION_TYPE,METHOD}) @Retention(RUNTIME) @Documented @API(status=STABLE, since="5.7") @TestTemplate @ExtendWith(org.junit.jupiter.params.ParameterizedTestExtension.class) public @interface ParameterizedTest
@ParameterizedTest is used to signal that the annotated method is a parameterized test method.

Such methods must not be private or static.

Arguments Providers and Sources

@ParameterizedTest methods must specify at least one ArgumentsProvider via @ArgumentsSource or a corresponding composed annotation (e.g., @ValueSource, @CsvSource, etc.). The provider is responsible for providing a Stream of Arguments that will be used to invoke the parameterized test method.

Formal Parameter List

A @ParameterizedTest method may declare additional parameters at the end of the method's parameter list to be resolved by other ParameterResolvers (e.g., TestInfo, TestReporter, etc). Specifically, a parameterized test method must declare formal parameters according to the following rules.

  1. Zero or more indexed arguments must be declared first.
  2. Zero or more aggregators must be declared next.
  3. Zero or more arguments supplied by other ParameterResolver implementations must be declared last.

In this context, an indexed argument is an argument for a given index in the Arguments provided by an ArgumentsProvider that is passed as an argument to the parameterized method at the same index in the method's formal parameter list. An aggregator is any parameter of type ArgumentsAccessor or any parameter annotated with @AggregateWith.

Argument Conversion

Method parameters may be annotated with @ConvertWith or a corresponding composed annotation to specify an explicit ArgumentConverter. Otherwise, JUnit Jupiter will attempt to perform an implicit conversion to the target type automatically (see the User Guide for further details).

Composed Annotations

@ParameterizedTest may also be used as a meta-annotation in order to create a custom composed annotation that inherits the semantics of @ParameterizedTest.


@ParameterizedTest methods are inherited from superclasses as long as they are not overridden according to the visibility rules of the Java language. Similarly, @ParameterizedTest methods declared as interface default methods are inherited as long as they are not overridden.

Test Execution Order

By default, test methods will be ordered using an algorithm that is deterministic but intentionally nonobvious. This ensures that subsequent runs of a test suite execute test methods in the same order, thereby allowing for repeatable builds. In this context, a test method is any instance method that is directly annotated or meta-annotated with @Test, @RepeatedTest, @ParameterizedTest, @TestFactory, or @TestTemplate.

Although true unit tests typically should not rely on the order in which they are executed, there are times when it is necessary to enforce a specific test method execution order — for example, when writing integration tests or functional tests where the sequence of the tests is important, especially in conjunction with @TestInstance(Lifecycle.PER_CLASS).

To control the order in which test methods are executed, annotate your test class or test interface with @TestMethodOrder and specify the desired MethodOrderer implementation.

See Also: