@@ -747,19 +747,19 @@ to the console.
747747Parameterized tests make it possible to run a test multiple times with different
748748arguments. They are declared just like regular `@Test` methods but use the
749749`{ParameterizedTest}` annotation instead. In addition, you must declare at least one
750- _source_ that will provide the arguments for each invocation.
750+ _source_ that will provide the arguments for each invocation and then _consume_ the
751+ arguments in the test method.
751752
752- WARNING: Parameterized tests are currently an _experimental_ feature. Consult the table
753- in <<api-evolution-experimental-apis>> for details .
753+ The following example demonstrates a parameterized test that uses the `@ValueSource`
754+ annotation to specify a `String` array as the source of arguments .
754755
755756[source,java,indent=0]
756757----
757758include::{testDir}/example/ParameterizedTestDemo.java[tags=first_example]
758759----
759760
760- This parameterized test uses the `@ValueSource` annotation to specify a `String` array as
761- the source of arguments. When executing the above method, each invocation will be
762- reported separately. For instance, the `ConsoleLauncher` will print output similar to the
761+ When executing the above parameterized test method, each invocation will be reported
762+ separately. For instance, the `ConsoleLauncher` will print output similar to the
763763following.
764764
765765....
@@ -769,12 +769,38 @@ palindromes(String) ✔
769769└─ [3] able was I ere I saw elba ✔
770770....
771771
772+ WARNING: Parameterized tests are currently an _experimental_ feature. Consult the table
773+ in <<api-evolution-experimental-apis>> for details.
774+
772775[[writing-tests-parameterized-tests-setup]]
773776==== Required Setup
774777
775778In order to use parameterized tests you need to add a dependency on the
776779`junit-jupiter-params` artifact. Please refer to <<dependency-metadata>> for details.
777780
781+ [[writing-tests-parameterized-tests-consuming-arguments]]
782+ === Consuming Arguments
783+
784+ Parameterized test methods typically _consume_ arguments directly from the configured
785+ source (see <<writing-tests-parameterized-tests-sources>>) following a one-to-one
786+ correlation between argument source index and method parameter index (see examples in
787+ <<writing-tests-parameterized-tests-sources-CsvSource>>). However, a parameterized test
788+ method may also choose to _aggregate_ arguments from the source into a single object
789+ passed to the method (see <<writing-tests-parameterized-tests-argument-aggregation>>).
790+ Additional arguments may also be provided by a `ParameterResolver` (e.g., to obtain an
791+ instance of `TestInfo`, `TestReporter`, etc.). Specifically, a parameterized test method
792+ must declare formal parameters according to the following rules.
793+
794+ * Zero or more _indexed arguments_ must be declared first.
795+ * Zero or more _aggregators_ must be declared next.
796+ * Zero or more arguments supplied by a `ParameterResolver` must be declared last.
797+
798+ In this context, an _indexed argument_ is an argument for a given index in the
799+ `Arguments` provided by an `ArgumentsProvider` that is passed as an argument to the
800+ parameterized method at the same index in the method's formal parameter list. An
801+ _aggregator_ is any parameter of type `ArgumentsAccessor` or any parameter annotated with
802+ `@AggregateWith`.
803+
778804[[writing-tests-parameterized-tests-sources]]
779805==== Sources of Arguments
780806
0 commit comments