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: [email protected]

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

Reply via email to