[英]How to run parallel suites in maven and Testng
I want to the Test Suites parallel from maven. 我想从Maven并行测试套件。 my pom.xml looks like below:
我的pom.xml如下所示:
<profiles>
<profile>
<id>API_AUTOMATION</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<parallel>suites</parallel>
<threadCount>8</threadCount>
<suiteXmlFiles>
<!-- TestNG suite XML files -->
<suiteXmlFile>./module1.xml</suiteXmlFile>
<suiteXmlFile>./module2.xml</suiteXmlFile>
</suiteXmlFiles>
<testSourceDirectory>src/main/java</testSourceDirectory>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
all the .xml
files are TestNG
file which are Test Suites. 所有的
.xml
文件都是TestNG
文件,它们是Test Suites。 please let me know, how to run the suites in parallel. 请让我知道如何并行运行套件。
Parallelmode "suites" is not supported by TestNG, neither via Surefire nor through any run type of TestNG. TestNG不支持并行模式“套件”,既不通过Surefire也不通过任何运行类型的TestNG。
From the command line options in the documentation: 从文档中的命令行选项 :
-parallel methods|tests|classes If specified, sets the default
mechanism used to determine how
to use parallel threads when
running tests. If not set,
default mechanism is not to use
parallel threads at all. This can
be overridden in the suite
definition.
The proof can be found in the v6.11 sources of XmlSuite
: 该证明可以在被发现的v6.11来源
XmlSuite
:
public class XmlSuite implements Serializable, Cloneable {
/** Parallel modes */
public enum ParallelMode {
TESTS("tests", false), METHODS("methods"), CLASSES("classes"), INSTANCES("instances"), NONE("none", false),
...
}
...
}
This applies to TestNG 6.11 and older versions. 这适用于TestNG 6.11和更低版本。
Consider adding the tests from multiple .xml files into one .xml file with multiple <test>
nodes and define the parallelism in the testng.xml
to be tests
. 考虑将来自多个.xml文件的测试添加到具有多个
<test>
节点的一个.xml文件中, 并在要tests
的testng.xml
定义并行性 。
您可以尝试使用<threadCountSuites>8</threadCountSuites>
属性,而不设置线程计数属性或将其设置为0。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.