Repository navigation
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Affected version
3.6.1
Bug description
Given the following JUnit Jupiter v6.1.3 test:
package com.example.project;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.Parameter;
import org.junit.jupiter.params.ParameterizedClass;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
@ParameterizedClass
@ValueSource(ints = { 1, 2 })
class CalculatorParameterizedClassTests {
@Parameter
int i;
@ParameterizedTest
@ValueSource(ints = { 1, 2 })
void parameterizedTest(int j) {
}
@Nested
@ParameterizedClass
@ValueSource(ints = { 1, 2 })
class Inner {
final int j;
Inner(int j) {
this.j = j;
}
@Test
void regularTest() {
}
}
}When running the regularTest with Surefire 3.6.0
mvn test -D'test=CalculatorParameterizedClassTests$Inner#regularTest'Surefire will execute 4 tests:
[INFO] --- surefire:3.6.0:test (default-test) @ junit-jupiter-starter-maven ---
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
...
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.055 s
[INFO] Finished at: 2026-10-26T13:27:59+01:00
[INFO] ------------------------------------------------------------------------
When ran with Surefire 3.6.1, no tests are executed.
[INFO] --- surefire:3.6.1:test (default-test) @ junit-jupiter-starter-maven ---
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.926 s
[INFO] Finished at: 2026-10-26T13:27:46+01:00
[INFO] ------------------------------------------------------------------------
Looking at the changes made to the TestPlanScannerFilter in a35e23b there seems to be a misunderstanding. The collectClassNames method assumes that all candidates will be in the test plan if they're discovered. This is not necessarily the case. They may be registered dynamically by one of their parent containers.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Activity
mpkorstanje commentedon Oct 26, 2026
Moreover, Surefire 3.6.1 also doesn't warn that no tests could be found as it would when trying to select the non-existent
NoSuchClassinner class: