mpkorstanje opened a new issue, #3548:
URL: https://github.com/apache/maven-surefire/issues/3548

   ### Affected version
   
   3.6.1
   
   ### Bug description
   
   Given the following test:
   
   ```java
   @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 ran with Surefire 3.6.0 
   
   ```bash
   mvn test -D'test=CalculatorParameterizedClassTests$Inner#regularTest'
   ```
   
   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](https://github.com/apache/maven-surefire/blame/1cad8a5ac4058b36999936cf8a8cd180a19971ca/surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/TestPlanScannerFilter.java#L116-L123)
 in a35e23b1ccc5aa848491cd75469f9a261e719cdf 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.
   
   
   
   
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to