You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Michael Osipov (Jira)" <ji...@apache.org> on 2023/01/07 08:45:00 UTC
[jira] [Updated] (SUREFIRE-1795) surefire-reports is not working in parallel
[ https://issues.apache.org/jira/browse/SUREFIRE-1795?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Osipov updated SUREFIRE-1795:
-------------------------------------
Fix Version/s: 3.0.0-M9
(was: 3.0.0-M8)
> 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-M9
>
>
> 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.20.10#820010)