You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Tibor Digana (Jira)" <ji...@apache.org> on 2020/05/22 19:44:00 UTC

[jira] [Commented] (SUREFIRE-1795) surefire-reports is not working in parallel

    [ https://issues.apache.org/jira/browse/SUREFIRE-1795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17114367#comment-17114367 ] 

Tibor Digana commented on SUREFIRE-1795:
----------------------------------------

We wanted to fix this general problem in 3.0.0-M5 but we implemented only "New interprocess communication with TCP/IP", see the [road map|https://maven.apache.org/surefire/maven-surefire-plugin/].

This issue is related to the JUnit as well and we have to postpone it to M6. These milestone versions would rework the code or break some API backwards compatibility therefore they are milestones.
{noformat}
(4) StatelessXmlReporter repeatedly generates XML report. It is stateful report and won't work if re-run or parallel executions send test events out of order.
{noformat}


> surefire-reports is not working in parallel
> -------------------------------------------
>
>                 Key: SUREFIRE-1795
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1795
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Maven Surefire Plugin
>    Affects Versions: 3.0.0-M4
>         Environment: Centos 7 +JDK 1.8.0 + Maven 3.0.5 + surefire plugin 2.19.1 + testng 6.8;
> Centos 7 + JDK 1.8.0 + Maven 3.5.2 + surefire plugin 2.19.1 + testng 6.8;
> Windows 10 + JDK 1.8.0 + Maven 3.5.0 + surefirel plugin 3.0.0-M4 + testng 6.8;
>  
>            Reporter: QIAO YU
>            Priority: Major
>             Fix For: 3.0.0-M6
>
>
> Create a maven project, add 4 testng classes to print out logs, for example:
> {code:java}
> package com.verizon.rngverify;
> import org.testng.annotations.Test;
> public class testClass1 {  
>     @Test public void test1() throws Exception { 
>         System.out.println("class1method1"); 
>         Thread.sleep(100); 
>         System.out.println("class1method1 end"); 
>     }
> }
> {code}
>  
> Create a testng xml file to control above 4 test cases in parallel with 4 threads:
> {code:java}
> <suite name="tsname" parallel="tests" thread-count="4" verbose="1">
>   <test name="testname1_in_xml" > 
>     <classes> 
>       <class name="com.verizon.rngverify.testClass1"/> 
>     </classes> 
>   </test>  
>   
>   <test name="testname2_in_xml"> 
>     <classes> 
>       <class name="com.verizon.rngverify.testClass2"/> 
>     </classes> 
>   </test>  
>   <test name="testname3_in_xml"> 
>     <classes> 
>       <class name="com.verizon.rngverify.testClass3" /> 
>     </classes> 
>   </test>  
>   <test name="testname4_in_xml"> 
>     <classes> 
>       <class name="com.verizon.rngverify.testClass4" /> 
>     </classes> 
>   </test>
> </suite>
> {code}
>  
> Use surefire plugin in pom:
> {code:java}
> <plugins> 
>   <plugin> 
>     <groupId>org.apache.maven.plugins</groupId> 
>     <artifactId>maven-compiler-plugin</artifactId> 
>     <version>3.7.0</version> 
>     <configuration> <source>1.8</source> <target>1.8</target> </configuration>      
>   </plugin>
>   <plugin> 
>     <groupId>org.apache.maven.plugins</groupId> 
>     <artifactId>maven-surefire-plugin</artifactId> 
>     <version>3.0.0-M4</version> 
>     <configuration> 
>       <suiteXmlFiles> <file>src/test/resources/ts1234.xml</file> </suiteXmlFiles>   
>     </configuration> 
>    </plugin>
>  </plugins>
> {code}
> Run above project:
> mvn clean install
>  
> ...
> [INFO] -------------------------------------------------------
>  [INFO] T E S T S
>  [INFO] -------------------------------------------------------
>  [INFO] Running TestSuite
>  class1method1
>  class2method1
>  class3method1
>  class4method1
>  class2method1 end
>  class3method1 end
>  class4method1 end
>  class1method1 end
>  [INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.617 s - in TestSuite
> ...
>  
> But in ${project}/target/surefire-reports/testng-results.xml, only 3 cases were found. Also under ${project}/target/surefire-reports/junitreports folder, only 3 files were generated.
>  
> In general, if the thread-count > 1, it happens randomly.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)