【问题标题】:re-runned failed test cases are comming with status = 'Skipped' in the testng report重新运行失败的测试用例在 testng 报告中带有 status = 'Skipped'
【发布时间】:2017-02-20 18:33:25
【问题描述】:

我使用 IRetryAnalyzer 重新运行失败的测试用例。我还使用 IAnnotationTransformer 作为 TestNg 侦听器。现在,报告中只有最后一次重新运行的测试用例计数失败。以前的迭代将被跳过。我希望所有的迭代都在报告中失败。

以下是 2 个类的代码:

对于 IAnnotationTransformer:

package com.TestNG;

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import org.testng.IAnnotationTransformer;
import org.testng.IRetryAnalyzer;
import org.testng.annotations.ITestAnnotation;

public class RetryListener implements IAnnotationTransformer {

@Override
public void transform(ITestAnnotation testannotation, Class testClass,
Constructor testConstructor, Method testMethod) {
IRetryAnalyzer retry = testannotation.getRetryAnalyzer();

if (retry == null)  {
testannotation.setRetryAnalyzer(Retry.class);
}
}

}

对于 IRetryAnalyzer :

package com.TestNG;

import org.testng.IRetryAnalyzer;
import org.testng.ITestResult;

public class Retry implements IRetryAnalyzer {
private int retryCount = 0;
private int maxRetryCount = 2;

@Override
public boolean retry(ITestResult result) {
if (retryCount < maxRetryCount) {
retryCount++;
return true;
}
return false;
}
}

结果: Screenshot

【问题讨论】:

    标签: testng testng-eclipse


    【解决方案1】:

    这是自 6.9.6 以来的新预期行为:https://github.com/cbeust/testng/blob/master/CHANGES.txt#L162

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-25
      • 1970-01-01
      • 1970-01-01
      • 2015-10-01
      • 1970-01-01
      相关资源
      最近更新 更多