testng 失败用例重试机制,添加listener 不生效

/**
 * 失败用例重试监听器
 */
public class retryListener implements IAnnotationTransformer {

    @Override
    public void transform(ITestAnnotation annotation, Class testClass, Constructor constructor, Method method) {
        IRetryAnalyzer retry = annotation.getRetryAnalyzer();
        if (retry == null) {
            annotation.setRetryAnalyzer(FailCaseRetry.class);
        }
    }
}

在测试类 添加Listener(retryListener.class) 用例执行失败后没有重跑,这是什么原因呢??

关闭