java - 在最大尝试次数后,Testng RetryListener 未使测试用例失败

标签 java maven selenium junit testng

我通过以下链接使用了 TestNG RetyListener http://www.seleniumeasy.com/testng-tutorials/execute-only-failed-test-cases-using-iretryanalyzer然后将监听器包含在 testng.xml 中。

  1. 当将测试用例作为 TestNG 套件运行时,工作正常,并且在最大重试次数后测试标记为 FAILURE
Selected environment: QA
Retrying test testcase1 with status FAILURE for the 1 time(s).
testcase1 skipped.
Retrying test testcase1 with status FAILURE for the 2 time(s).
testcase1 skipped.
Retrying test testcase1 with status FAILURE for the 3 time(s).
testcase1 skipped.
ERROR: testcase1 has failed
  • 当使用 maven 命令(mvn clean test)运行它时,测试在最大重试次数后被标记为跳过,这会导致 Allure 报告生成出现问题
  • Retrying test testcase1 with status FAILURE for the 1 time(s).
    testcase1 skipped.
    Retrying test testcase1 with status FAILURE for the 2 time(s).
    testcase1 skipped.
    Retrying test testcase1 with status SKIP for the 3 time(s).
    

    需要帮助才能在使用 Maven 时获得与 TestNG 相同的行为

    最佳答案

    将您的 TestNG 依赖项更新到最新版本:

      <!-- https://mvnrepository.com/artifact/org.testng/testng -->
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.14.3</version>
        <scope>test</scope>
    </dependency>
    

    关于java - 在最大尝试次数后,Testng RetryListener 未使测试用例失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51482788/

    相关文章:

    Java 错误 : "Could not find or load main class .ie.driver" with selenium

    java - 在抽屉导航中跨多个组实现多项选择

    java - JSF setLocale 不能正常工作

    java - 为什么 javafx-maven-plugin :jlink cause a java. nio.file.AccessDeniedException?

    maven - 父pom的版本RELEASE或LATEST

    c# - 如何在 C# 中通过 Selenium 将图像上传到 Saucelabs 测试中的网页?

    Java EE : Getting parameters from POST for a login form

    java - 我希望它在应用程序中打开 url,而不是 webview

    eclipse - 在服务器上部署时 Maven API 不响应 (Tomcat 7)

    java - 断言处理在 "console"和 "result of running suite"中给出不同的结果