Java Code Examples for org.testng.annotations.ITestAnnotation#setRetryAnalyzer()

The following examples show how to use org.testng.annotations.ITestAnnotation#setRetryAnalyzer() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FailRetryAnnotationTransformer.java    From agent with MIT License 5 votes vote down vote up
@Override
public void transform(ITestAnnotation annotation, Class testClass, Constructor testConstructor, Method testMethod) {
    Class retry = annotation.getRetryAnalyzerClass();
    if (retry != FailRetryAnalyzer.class) {
        annotation.setRetryAnalyzer(FailRetryAnalyzer.class);
    }
}
 
Example 2
Source File: RetryListener.java    From gsc-core with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void transform(ITestAnnotation testannotation, Class testClass,
    Constructor testConstructor, Method testMethod) {
  IRetryAnalyzer retry = testannotation.getRetryAnalyzer();

  if (retry == null) {
    testannotation.setRetryAnalyzer(Retry.class);
  }
}
 
Example 3
Source File: RetryListener.java    From WebAndAppUITesting with GNU General Public License v3.0 5 votes vote down vote up
@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]));
		}

	}

}
 
Example 4
Source File: AnnotationListener.java    From pulsar with Apache License 2.0 5 votes vote down vote up
@Override
public void transform(ITestAnnotation annotation, Class testClass, Constructor testConstructor, Method testMethod) {
    annotation.setRetryAnalyzer(RetryAnalyzer.class);

    // Enforce default test timeout
    if (annotation.getTimeOut() == 0) {
        annotation.setTimeOut(DEFAULT_TEST_TIMEOUT_MILLIS);
    }
}
 
Example 5
Source File: TestRetryListener.java    From seleniumtestsframework with Apache License 2.0 5 votes vote down vote up
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);
    }
}
 
Example 6
Source File: RetryListener.java    From AppiumTestDistribution with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void transform(ITestAnnotation iTestAnnotation,
                      Class aClass, Constructor constructor, Method method) {
    Class<? extends IRetryAnalyzer> retry = iTestAnnotation.getRetryAnalyzerClass();
    if (retry == null) {
        iTestAnnotation.setRetryAnalyzer(Retry.class);
    }
}