Maven Surefire 不会重新运行失败的 testng 测试,我的配置有什么问题?

标签 maven testng maven-surefire-plugin

我是 Surefire 插件的新手,并尝试设置以重新运行片状测试。

我的配置如下:

            <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>3.0.0-M2</version>
            <configuration>
                <suiteXmlFiles>
                    <suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
                </suiteXmlFiles>
                <rerunFailingTestsCount>1</rerunFailingTestsCount>
            </configuration>
        </plugin>

我使用的命令是:

mvn clean test -DsuiteXmlFile=testNG.xml -Dsurefire.rerunFailingTestsCount=2

我得到了:

[ERROR] Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 11.12 s <<< FAILURE! - in TestSuite

[ERROR] ieTest1(com.mycompany.testcases.Sample.independentTest)  Time elapsed: 3.839 s  <<< FAILURE!

java.lang.AssertionError: expected [true] but found [false]

但是我可以看到生成的/target/surefire-reports,但没有重新运行。任何人都可以帮助找出为什么重播没有触发?

最佳答案

根据http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#rerunFailingTestsCount , rerunFailingTestsCount 仅适用于自 3.0.0-M4 起的 JUnit 4+ 提供程序和 JUnit 5+ 提供程序,不适用于 TestNG。

我也在调查这个问题,到目前为止最完整的解释似乎在那里:https://www.toolsqa.com/selenium-webdriver/retry-failed-tests-testng/

关于Maven Surefire 不会重新运行失败的 testng 测试,我的配置有什么问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53734572/

相关文章:

java - Maven的pom.xml中的pluginManagement是什么?

java - 如何使用Gradle为Selenium TestNG项目创建具有依赖项的可执行JAR?

java - Selenium 截图监听器抓取错误的浏览器

maven - 使用 JaCoCo 合并集成和单元测试报告

maven - 如何与 maven surefire 插件并行运行 scalatest?

java - 在 Java 中生成数据驱动的单元测试

java - Spring +Maven | 404错误: The requested resource is not available

java - 如何在 Maven 和 IntelliJ 之间共享 Clover 覆盖率数据

java - 找不到单元测试的 'annotation declaring class'

java - Surefire Maven 插件 : "Corrupted STDOUT by directly writing to native stream in forked JVM"