Surefire按顺序运行某些测试,其他测试并行运行

时间:2015-05-01 09:54:55

标签: java automated-tests pom.xml surefire test-suite

有没有办法使用JUnit的surefire插件按顺序运行某些测试?目前它正在并行运行所有测试,但是一些测试很难转换,如果它们没有并行运行就足够了。这是我们的pom.xml的一部分:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.17</version>
    <dependencies>
      <dependency>
        <groupId>org.apache.maven.surefire</groupId>
        <artifactId>surefire-junit47</artifactId>
        <version>2.17</version>
      </dependency>
    </dependencies>
    <configuration>
        <parallel>all</parallel>
        <threadCount>8</threadCount>
      <includes>
        <include>${includeTest}</include>
        <include>${includeAdditionalTest}</include>
      </includes>
    </configuration>
</plugin>

3 个答案:

答案 0 :(得分:6)

咨询surefire plugin documentation。它提供了一种使用@NotThreadSafe注释指定某些测试不是线程安全的方法。

另一种解决方案是使用显式test inclusions and exclusions指定两个单独的surefire执行。一个执行可以以并行模式运行,包括线程安全套件,另一个非线程安全。

答案 1 :(得分:1)

我们可以通过定义多个let base64String = await this.file.readAsDataURL(pdfFilePath, pdfFilename)

来实现
executions

答案 2 :(得分:0)

是,

将每个顺序测试放在自己的套件中,并将所有并行测试放在一个套件中。然后设置并行属于类。

&#13;
&#13;
For grid layouts, use .col-xs-* classes in addition to, or in place of, the medium/large ones. Don't worry, the extra-small device grid scales to all resolutions.
&#13;
&#13;
&#13;