【问题标题】:Maven surefire plugin suiteXmlFile parallel executionMaven surefire 插件套件XmlFile 并行执行
【发布时间】:2019-07-05 10:06:59
【问题描述】:

定义了 suiteXmlFile 时是否可以并行执行?我的配置如下。如果测试是在线程中并行执行的,我们也可以吗?它是否出现在日志文件中?

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.20</version>
    <configuration>
        <!-- Suite testng xml file to consider for test execution -->
        <parallel>classes</parallel>
        <threadCount>10</threadCount>
        <suiteXmlFiles>
            <suiteXmlFile>mytests.xml</suiteXmlFile>
            <!--<suiteXmlFile>suites-test-testng.xml</suiteXmlFile>-->
        </suiteXmlFiles>
    </configuration>
</plugin>
<plugin>

【问题讨论】:

    标签: maven maven-plugin maven-surefire-plugin


    【解决方案1】:

    当你有testng.xml时,你可以直接在testng.xml中提到parallel属性,它自己rt,如果你有多个testng文件并且你想并行执行它们,那么你可以使用

    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.20</version>
    <configuration>
    <forkCount>3</forkCount>
    <reuseForks>true</reuseForks>
    <parallel>classes</parallel>
    <threadCount>10</threadCount>
    <suiteXmlFiles>
    <suiteXmlFile>**/*-testng.xml</suiteXmlFile>
    <!--<suiteXmlFile>suites-test-testng.xml</suiteXmlFile>-->
    </suiteXmlFiles>
    </configuration>
    </plugin>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-05-26
      • 2016-02-20
      • 1970-01-01
      • 2021-05-16
      • 2015-12-19
      • 1970-01-01
      • 1970-01-01
      • 2021-04-22
      相关资源
      最近更新 更多