您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

TestNG retryAnalyzer仅在方法@Test中定义时起作用,而在类的@Test中不起作用

TestNG retryAnalyzer仅在方法@Test中定义时起作用,而在类的@Test中不起作用

我的解决方案是为该方法中的所有方法设置一个retryAnalyzer@BeforeSuite。但是不要在beforeMethod中设置它,因为这样每次调用时都会使用新的counter => endless loop重新创建它。

@BeforeSuite(alwaysRun = true)
public void beforeSuite(ITestContext context) {
     TestRepeat testRepeat = new TestRepeat();
     for (ITestNGMethod method : context.getAllTestMethods()) {
         method.setRetryAnalyzer(testRepeat);
     }
}
其他 2022/1/1 18:17:33 有515人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶