我通过以下链接使用了 TestNG RetyListener http://www.seleniumeasy.com/testng-tutorials/execute-only-failed-test-cases-using-iretryanalyzer然后将监听器包含在 testng.xml 中。
- 当将测试用例作为 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/