我们正在使用maven-surefire-plugin运行我们的自动化测试,并且在所有测试完成后,我们尝试使失败的测试重新运行。我们的插件配置如下:
父项目:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>${surefire.version}</version>
</dependency>
</dependencies>
<configuration>
<parallel>classes</parallel>
<forkCount>10</forkCount>
<reuseForks>false</reuseForks>
<threadCount>1</threadCount>
<rerunFailingTestsCount>1</rerunFailingTestsCount>
<trimStackTrace>false</trimStackTrace>
<excludes>
<exclude>**/randomPackage/*Test.java</exclude>
</excludes>
<systemPropertyVariables>
<randomSystemProp>true</randomSystemProp>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
子项目:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
</plugins>
</build>
当我们执行目标 干净测试 (或只是 test )时,一切都很好,除了失败的测试重新运行时< / strong>!如HERE所述,在使用surefire-junit47提供程序时,应在所有测试类完成后执行所有重新运行:
提供者surefire-junit47执行所有测试类,然后重新运行失败的测试。
我们尝试将插件配置移入pom子级,但没有运气,结果是一样的-失败后立即重新运行!
感谢您的帮助!谢谢!
编辑: 使用的插件版本是2.22.2,但我们尝试使用的插件版本以及最新的3.0.0-M3都很少。