You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "NicoLaval (via GitHub)" <gi...@apache.org> on 2025/04/29 07:24:16 UTC

[I] Junit 5/Surefire issue [maven-surefire]

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

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


Re: [I] Junit 5/Surefire issue [maven-surefire]

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

   should be fixed with 3.6.0-M1 if not please reopen 


-- 
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] Junit 5/Surefire issue [maven-surefire]

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

   Have you tried [configuring](https://maven.apache.org/surefire/maven-surefire-plugin/examples/junit-platform.html#Surefire_Extensions_and_Reports_Configuration_for_.40DisplayName) it?


-- 
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] Junit 5/Surefire issue [maven-surefire]

Posted by "olamy (via GitHub)" <gi...@apache.org>.
olamy closed issue #835: Junit 5/Surefire issue
URL: https://github.com/apache/maven-surefire/issues/835


-- 
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