简体   繁体   English

如何在Maven和Testng中运行并行套件

[英]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.

相关问题 Netbeans + Maven + TestNG-如何从Netbeans运行测试套件? - Netbeans + Maven + TestNG - How to run test suites from netbeans? 使用 maven 故障安全并行运行套件 - run suites in parallel using maven failsafe 如何参数化Maven surefire插件,以便我可以选择运行哪些TestNG套件 - How to parametrize Maven surefire plugin so I can choose which TestNG suites to run 如何使用Jenkins中的maven从多个套件运行特定的TestNG套件 - How to run a particular TestNG suite from multiple suites using maven in Jenkins TestNG-并行执行测试套件 - TestNG - parallel executing Test Suites TestNg + Maven + Allure:如何在报告中为套件生成正确的名称 - TestNg + Maven + Allure: How to generate correct name for suites in the report 如何创建与TestNG + Maven并行工作(套件) - How creating parallel work to TestNG + Maven (Suits) 并行运行多个testng套件,每个套件具有不同的参数 - Running Multiple testng suites in parallel with different parameters for each of those suites 使用testng和maven运行不同的测试套件 - Running different test suites using testng and maven Maven / TestNG / Selenium-我可以在一个testng.xml中设置多个测试套件,并在不同的时间运行不同的套件吗? - Maven/TestNG/Selenium - Can I set up multiple tests suites in one testng.xml and run different ones at different times?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM