Skip to content
Latchkey

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.

junit
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.

java
@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.

gradle
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.

java
static Stream<Arguments> cases() {
  return Stream.of(Arguments.of(1, "a"), Arguments.of(2, "b"));
}

How to prevent it

  • Always pair @ParameterizedTest with an explicit arguments source.
  • Include junit-jupiter-params alongside the API and engine.
  • Keep @MethodSource factories static and non-empty.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →