JUnit 5 "@ParameterizedTest ... must declare at least one ArgumentsSource" - Fix in CI
A JUnit 5 @ParameterizedTest ran with no argument source. Either you forgot the @ValueSource/@MethodSource/@CsvSource annotation, or junit-jupiter-params is not on the test classpath so the parameterized infrastructure is absent.
What this error means
The test errors (not fails) with Configuration error: You must configure at least one set of arguments for this @ParameterizedTest or org.junit.jupiter.params... cannot be found. The method is detected but cannot be supplied inputs.
org.junit.jupiter.api.extension.ParameterResolutionException:
Configuration error: You must configure at least one set of arguments for
this @ParameterizedTest
at org.junit.jupiter.params.ParameterizedTestExtension...Common causes
No arguments-source annotation
The method is @ParameterizedTest but lacks @ValueSource/@MethodSource/@CsvSource, so JUnit has nothing to feed it.
junit-jupiter-params not on the classpath
Only junit-jupiter-api was added; the params module that provides parameterized support is missing.
A @MethodSource that resolves to nothing
The referenced factory method returns an empty stream or is not static/visible, so no arguments are produced.
How to fix it
Add an arguments source
Provide the inputs the parameterized test consumes.
@ParameterizedTest
@ValueSource(ints = {1, 2, 3})
void isPositive(int n) { assertTrue(n > 0); }Add junit-jupiter-params
Ensure the params module is on the test classpath.
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.11.0'Fix a @MethodSource factory
Make the factory static and ensure it returns a non-empty stream.
static Stream<Arguments> cases() {
return Stream.of(Arguments.of(1, "a"), Arguments.of(2, "b"));
}How to prevent it
- Always pair
@ParameterizedTestwith an explicit arguments source. - Include
junit-jupiter-paramsalongside the API and engine. - Keep
@MethodSourcefactories static and non-empty.