Advertisement

TestNG - Failed retry

阅读量:

TestNG - Failed retry

TestNG - 重试失败

作者: Max.Bai

时间: 2015/01

TestNG 的失败重试机制

1. 创建自己的IRetryAnalyzer

对retry方法进行重构,读取xml配置中设定的重试次数,并验证当前失败次数是否低于该设定值,若条件成立则返回true

复制代码
 import org.testng.IRetryAnalyzer;

    
 import org.testng.ITestResult;
    
  
    
 public class TestRetryAnalyzer implements IRetryAnalyzer {
    
 	private static final String TEST_RETRY_COUNT = "testRetryCount";
    
 	private int currentTry = 0;
    
 	private int m_maxRetries = 0;
    
  
    
 	public TestRetryAnalyzer() {
    
 		currentTry=0;
    
 		m_maxRetries=3;
    
 	}
    
  
    
 	public int getC

全部评论 (0)

还没有任何评论哟~