这个查询是w.r.t.并行执行PaxExam注释的Junit测试类 .

正在使用的图书馆:

  • Junit 4.12

  • Pax考试4.9.1

  • Maven Surefire插件2.18.1

以下是Maven Surefire插件配置:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
        <parallel>suites</parallel>
        <useUnlimitedThreads>true</useUnlimitedThreads>
        <perCoreThreadCount>true</perCoreThreadCount>
        <threadCountSuites>0</threadCountSuites>
        <threadCount>0</threadCount>
        <parallelOptimized>true</parallelOptimized>
        <runorder>filesystem</runorder>
        <includes>
            <include>**/Suite1.java</include>
            <include>**/Suite2.java</include>
        </includes>
    </configuration>
</plugin>

有2个Junit Suites Suite1.javaSuite2.java

上面的每个套件包含2个测试类,每个类使用 @RunWith(PaxExam.class)@ExamReactorStrategy(PerSuite.class) 注释

此外,每个测试类都有一个使用 @Test 注释的方法 .

执行 mvn clean test 时,套件不会并行运行 .

进一步深入研究Pax ReactorManager 将所有4个测试类添加到一个Set下,即ReactorManager处理ONE套件中的所有测试类 . 此外,在maven日志中,语句 suite finished 仅记录一次 .

有任何建议如何在PAX考试的背景下并行运行Junit套件?