You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "wilx (via GitHub)" <gi...@apache.org> on 2026/08/26 06:40:30 UTC

[I] Direct selection of JUnit Jupiter @Nested class runs no tests since 3.6.0-M1 [maven-surefire]

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

   ### Affected version
   
   3.6.0-M1 and 3.6.0-M2-SNAPSHOT (`b2e1f70b2`). The same test works with 3.5.4.
   
   ### Bug description
   
   Selecting a non-static JUnit Jupiter `@Nested` test class directly by its JVM binary name runs no tests since Surefire 3.6.0-M1. Maven exits successfully and produces no test report.
   
   Given:
   
   ```java
   package example;
   
   import org.junit.jupiter.api.BeforeEach;
   import org.junit.jupiter.api.Nested;
   import org.junit.jupiter.api.Test;
   
   import static org.junit.jupiter.api.Assertions.assertTrue;
   
   class OuterTest {
       private boolean outerSetUp;
   
       @BeforeEach
       void setUpOuter() {
           outerSetUp = true;
       }
   
       @Nested
       class Selected {
           @Test
           void selectedTest() {
               assertTrue(outerSetUp);
           }
       }
   }
   ```
   
   Run the test using the quoted binary name so that the shell does not expand `$Selected`:
   
   ```shell
   mvn -Dtest='example.OuterTest$Selected' test
   ```
   
   Expected: `selectedTest` runs, including the enclosing `@BeforeEach` lifecycle callback.
   
   Actual with 3.6.0-M1 and current master: zero tests run, Maven exits successfully, and no Surefire report is produced.
   
   With Surefire 3.5.4, the same command executes the selected nested test as expected. Direct selection of a `static` nested class also still works on current master, so this is specific to the enclosing hierarchy required by a non-static `@Nested` class.
   
   JUnit documents that nested tests can be run independently while lifecycle setup from enclosing classes is still executed:
   https://docs.junit.org/5.14.4/writing-tests/nested-tests.html
   
   Related issues:
   
   - #2107 covered selecting the enclosing class and including its `@Nested` descendants. That case remains fixed.
   - #2852 and #3021 previously confirmed that direct selection using an escaped or quoted `$` binary name is supported.
   
   This appears to be a regression from the provider-level class-name filtering added in https://github.com/apache/maven-surefire/pull/3179. JUnit represents a non-static nested selection with its enclosing hierarchy, and the exact nested-class include appears to reject the enclosing class descriptor.
   


-- 
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: issues-unsubscribe@maven.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Direct selection of JUnit Jupiter @Nested class runs no tests since 3.6.0-M1 [maven-surefire]

Posted by "wilx (via GitHub)" <gi...@apache.org>.
wilx commented on issue #3446:
URL: https://github.com/apache/maven-surefire/issues/3446#issuecomment-5434675323

   > Thanks but no need to open a issue if you are opening a PR straight away just put this description in the PR description this will avoid too much noise.
   
   OK. Will do. 


-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Direct selection of JUnit Jupiter @Nested class runs no tests since 3.6.0-M1 [maven-surefire]

Posted by "olamy (via GitHub)" <gi...@apache.org>.
olamy closed issue #3446: Direct selection of JUnit Jupiter @Nested class runs no tests since 3.6.0-M1
URL: https://github.com/apache/maven-surefire/issues/3446


-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Direct selection of JUnit Jupiter @Nested class runs no tests since 3.6.0-M1 [maven-surefire]

Posted by "olamy (via GitHub)" <gi...@apache.org>.
olamy commented on issue #3446:
URL: https://github.com/apache/maven-surefire/issues/3446#issuecomment-5432866495

   Thanks but no need to open a issue if you are opening a PR straight away
   just put this description in the PR description this will avoid too much noise.
   


-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org