Java 类org.testng.IRetryAnalyzer 实例源码

项目:seletest    文件:AnnotationTransformer.java   
@Override
@SuppressWarnings("rawtypes")
public void transform(final ITestAnnotation test, final Class testClass, final Constructor testConstructor, final Method testMethod) {

    //Set DataProvider for the test
    if (testMethod != null){
        if(dataType(testMethod)!=null) {
            if(dataType(testMethod).equals(Data.PROPERTIES)) {
                test.setDataProviderClass(DataSources.class);
                test.setDataProvider(dataPropertiesSource);
            } else if(dataType(testMethod).equals(Data.EXCEL)){
                test.setDataProviderClass(DataSources.class);
                test.setDataProvider(dataExcelSource);
            }
        }
    }

    //Set retry analyzer class for all @Test methods
    IRetryAnalyzer retry = test.getRetryAnalyzer();
    if (retry==null){
        test.setRetryAnalyzer(RetryAnalyzer.class);
    }
}
项目:carina    文件:AbstractTestListener.java   
@Override
public void onTestFailure(ITestResult result)
{
    int count = RetryCounter.getRunCount();
    int maxCount = RetryAnalyzer.getMaxRetryCountForTest();
    LOGGER.debug("count: " + count + "; maxCount:" + maxCount);

    IRetryAnalyzer retry = result.getMethod().getRetryAnalyzer();
    if (count < maxCount && retry == null)
    {
        LOGGER.error("retry_count will be ignored as RetryAnalyzer is not declared for "
                + result.getMethod().getMethodName());
    }

    if (count < maxCount && retry != null && !Jira.isRetryDisabled(result))
    {
        failRetryItem(result, Messager.RETRY_RETRY_FAILED, count, maxCount);
    } else
    {
        failItem(result, Messager.TEST_FAILED);
        afterTest(result);
    }

    super.onTestFailure(result);
}
项目:WebAndAppUITesting    文件:RetryListener.java   
@SuppressWarnings("rawtypes")
@Override
public void transform(ITestAnnotation annotation, Class testClass, Constructor testConstructor, Method testMethod) {

    IRetryAnalyzer retry = annotation.getRetryAnalyzer();
    if (retry == null) {
        annotation.setRetryAnalyzer(TestngRetry.class);
    }

    // 设置 默认循环次数
    ConfigUtil property = ConfigUtil.getInstance();
    int count = Integer.valueOf(property.getProperty("loopCount"));
    LogUtil.info("默认每个方法循环" + count + "次");
    annotation.setInvocationCount(count);

    // 设置 需要特殊处理方法的循环次数
    String excepLoopCount = property.getProperty("excepLoopCount");
    String[] excepCount = excepLoopCount.split(";");
    for (int i = 0; i < excepCount.length; i++) {
        String[] temp = excepCount[i].split(",");
        if (testMethod.getName().equals(temp[0])) {
            LogUtil.info("该方法循环" + temp[1] + "次");

            annotation.setInvocationCount(Integer.valueOf(temp[1]));
        }

    }

}
项目:oldmonk    文件:RetryListener.java   
@SuppressWarnings("rawtypes")
public void transform(final ITestAnnotation annotation, final Class testClass, final Constructor testConstructor,
        final Method testMethod)
{
    final IRetryAnalyzer retry = annotation.getRetryAnalyzer();
    if (retry == null)
    {
        annotation.setRetryAnalyzer(Retry.class);
    }
}
项目:webUIAuto    文件:RetryListener.java   
@Override
public void transform(ITestAnnotation annotation, Class testClass, Constructor testConstructor, Method testMethod) {
    IRetryAnalyzer retry = annotation.getRetryAnalyzer();
       if (retry == null) {
           annotation.setRetryAnalyzer(TestngRetry.class);
       }        
}
项目:seleniumtestsframework    文件:TestRetryListener.java   
public void transform(final ITestAnnotation annotation, final Class testClass, final Constructor testConstructor,
        final Method testMethod) {
    IRetryAnalyzer retryAnalyzer = annotation.getRetryAnalyzer();
    if (retryAnalyzer == null) {
        annotation.setRetryAnalyzer(TestRetryAnalyzer.class);
    }
}
项目:OptimusPrime    文件:AnnotationTransformer.java   
public void transform(ITestAnnotation annotation, Class testClass,
        Constructor testConstructor, Method testMethod) {
    IRetryAnalyzer analyzer = annotation.getRetryAnalyzer();

    if (analyzer == null) {
        annotation.setRetryAnalyzer(FailedTestsRetryListner.class);
    }

}
项目:web-test-framework    文件:RetryTestListener.java   
/**
 *
 * @param result
 */
@Override
  public void onTestStart(ITestResult result) {
      RetryTestContext context = getRetryContext(result);
      if (context != null) {

          if (result.getMethod().getRetryAnalyzer() == null) {
              IRetryAnalyzer retryAnalyzer = new RetryTestAnalyzer(context);
              result.getMethod().setRetryAnalyzer(retryAnalyzer);
          }
      }
  }
项目:web-test-framework    文件:RetryTestListener.java   
/**
   *
   * @param result
   */
  @Override
    public void onTestFailure(ITestResult result) {
        IRetryAnalyzer retryAnalyzer = result.getMethod().getRetryAnalyzer();
        if(retryAnalyzer instanceof RetryTestAnalyzer){
            RetryTestAnalyzer retryTestAnalyzer = (RetryTestAnalyzer) retryAnalyzer;

            if (retryTestAnalyzer.willRetry()) {
                result.setStatus(TestResult.SKIP);
            }

        }

//        RetryTestContext context = getRetryContext(result);
//        if (context != null) {
//
//            IRetryAnalyzer retryAnalyzer = result.getMethod().getRetryAnalyzer();
//            Assert.assertTrue(retryAnalyzer instanceof RetryTestAnalyzer, "RetryAnalyzer wasn't initialized first.");
//            RetryTestAnalyzer analyzer = (RetryTestAnalyzer) retryAnalyzer;
//            
//            // It's too late to change the TestResult Status in the Retry Analyzer so it
//            // must be set here. Feel free to set it to PASS if desired.
//            if (analyzer.willRetry()) {
//                result.setStatus(TestResult.SKIP);
//            }
//        }

    }
项目:AppiumTestDistribution    文件:AppiumParallelMethodTestListener.java   
@Override
public void onTestSkipped(ITestResult result) {
    ExtentTestManager.extent.removeTest(ExtentTestManager.getTest());
    IRetryAnalyzer retryAnalyzer = result.getMethod().getRetryAnalyzer();
    if (((Retry) retryAnalyzer).retryCountForTest == ((Retry) retryAnalyzer).maxRetryCount) {
        (reportManager.parentTest.get()).getModel().setStatus(Status.SKIP);
        (reportManager.childTest.get()).getModel().setStatus(Status.SKIP);
        ExtentManager.getExtent().flush();
    }
}
项目:AppiumTestDistribution    文件:RetryListener.java   
@Override
public void transform(ITestAnnotation iTestAnnotation,
                      Class aClass, Constructor constructor, Method method) {
    IRetryAnalyzer retry = iTestAnnotation.getRetryAnalyzer();

    if (retry == null) {
        iTestAnnotation.setRetryAnalyzer(Retry.class);
    }
}
项目:wtf-core    文件:BaseListener.java   
public static BaseTestRetryAnalyzer getIRA(ITestResult result) {
  IRetryAnalyzer ira = result.getMethod().getRetryAnalyzer();
  if (ira instanceof BaseTestRetryAnalyzer) {
    ira = (BaseTestRetryAnalyzer)ira;
  } else {
    ira = new BaseTestRetryAnalyzer();
  }
  return (BaseTestRetryAnalyzer) ira;
}
项目:selenium-test-automation-framework    文件:RetryListener.java   
@Override
public void transform(ITestAnnotation annotation, Class testClass, Constructor constructor, Method method) {
  IRetryAnalyzer retry = annotation.getRetryAnalyzer();

  if(retry == null) {
    annotation.setRetryAnalyzer(RetryFailed.class);
  }
}
项目:carina    文件:AnnotationTransformer.java   
@SuppressWarnings("rawtypes")
@Override
public void transform(ITestAnnotation testAnnotation, Class clazz, Constructor test, Method method)
{
    IRetryAnalyzer retry = testAnnotation.getRetryAnalyzer();
    if (retry == null)
    {
        testAnnotation.setRetryAnalyzer(RetryAnalyzer.class);
    }
    LOGGER.debug("retry analyzer: " + method.getName() + testAnnotation.getRetryAnalyzer());
}
项目:tempto    文件:DelegateTestNGMethod.java   
@Override
public IRetryAnalyzer getRetryAnalyzer()
{
    return delegate.getRetryAnalyzer();
}
项目:tempto    文件:DelegateTestNGMethod.java   
@Override
public void setRetryAnalyzer(IRetryAnalyzer retryAnalyzer)
{
    delegate.setRetryAnalyzer(retryAnalyzer);
}