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

Mat*_*ias 3 java automated-tests test-suite surefire pom.xml

有没有办法让某些测试与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>
Run Code Online (Sandbox Code Playgroud)

Pio*_*dyl 6

请查阅surefire插件文档。它提供了一种使用@NotThreadSafe批注指定某些测试不是线程安全的方法。

另一个解决方案是使用显式测试包含和排除指定两个单独的surefire执行。一个执行可以在并行模式下运行,包括线程安全套件,而另一个则是非线程安全的。