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

   ### Affected version
   
   3.5.3
   
   ### Bug description
   
   Hi,
   
   I'm using Junit Jupiter 5 and surefire to run my Java tests (Java 17).
   I didn't succeed to inject `displayName` in my `surefire` report:
   
   ```xml
     <testcase name="dynamicTestsFromCollection()[1]" classname="my_package" 
time="0.0"/>
     <testcase name="dynamicTestsFromCollection()[2]" classname="my_package" 
time="0.0"/>
     <testcase name="dynamicTestsFromCollection()[3]" classname="my_package" 
time="0.0"/>
   ```
   
   Here is my Java test class:
   
   ```java
   class MyTest {
   
       @TestFactory
       Collection<DynamicTest> dynamicTestsFromCollection() {
           return Arrays.asList(
                   DynamicTest.dynamicTest("1st dynamic test", () -> 
assertTrue(isEven(2))),
                   DynamicTest.dynamicTest("2nd dynamic test", () -> 
assertTrue(isEven(4))),
                   DynamicTest.dynamicTest("3rd dynamic test", () -> 
assertFalse(isEven(3)))
           );
       }
   
       private boolean isEven(int number) {
           return number % 2 == 0;
       }
   }
   ```
   
   Here is my configuration:
   
   ```xml
       <dependencies>
           <dependency>
               <groupId>org.junit.jupiter</groupId>
               <artifactId>junit-jupiter</artifactId>
               <scope>test</scope>
           </dependency>
           <dependency>
               <groupId>org.junit.platform</groupId>
               <artifactId>junit-platform-launcher</artifactId>
               <scope>test</scope>
           </dependency>
           ...
       </dependencies>
   
       <dependencyManagement>
           <dependencies>
               <dependency>
                   <groupId>org.junit</groupId>
                   <artifactId>junit-bom</artifactId>
                   <version>5.12.2</version>
                   <type>pom</type>
                   <scope>import</scope>
               </dependency>
           </dependencies>
       </dependencyManagement>
   
       <build>
           <plugins>
               <plugin>
                   <groupId>org.apache.maven.plugins</groupId>
                   <artifactId>maven-surefire-plugin</artifactId>
                   <version>3.5.3</version>
                   <configuration>
                       <argLine>--add-exports 
java.base/sun.nio.ch=ALL-UNNAMED</argLine>
                       <useModulePath>false</useModulePath> <!-- mandatory for 
JUnit 5 -->
                       <systemProperties>
                           <property>
                               
<name>junit.jupiter.displayname.generator.default</name>
                               
<value>org.junit.jupiter.api.DisplayNameGenerator$Standard</value>
                           </property>
                       </systemProperties>
                   </configuration>
               </plugin>
               ...
           </plugins>
       </build>
   ```
   
   


-- 
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-unsubscr...@maven.apache.org.apache.org

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

Reply via email to