关于失败用例自动重运行的问题
这样写能实现失败用例重运行,但是第二条用例并没有失败也会执行2次,要怎么改才能让第二条成功的不执行两次呢?public class retryLis implements IAnnotationTransformer {
public void transform(ITestAnnotation annotation, Class testClass,
Constructor testConstructor, Method testMethod) {
IRetryAnalyzer retry = annotation.getRetryAnalyzer();
if (retry == null) {
annotation.setRetryAnalyzer(retry.class);
}
}
}
public class retryimplements IRetryAnalyzer {
private int retryCount = 0;
private int maxRetryCount = 2; // retry a failed test 2 additional times
public boolean retry(ITestResult result) {
if (retryCount <maxRetryCount) {
retryCount++;
return true;
}
return false;
}
}
public class mycase {
@DataProvider(name = "test")
public static Object[][] NoNameMethod(){
return new Object[][]{{0},{1},{2}};
}
@Test(dataProvider = "test")
public void myTestCase(int a) {
Assert.assertEquals(a,1,"出错了");
}
}
http://www.daoehua.com/data/attachment/forum/201703/03/143511xsnmm2emms8y0080.png
http://www.51testing.com/html/75/5175-823395.html
参考一下 jingzizx 发表于 2017-3-4 08:55
http://www.51testing.com/html/75/5175-823395.html
参考一下
文中的skippedCases和failedCases是怎样定义的,在哪里定义?:$
页:
[1]