本文整理汇总了Java中org.testng.IRetryAnalyzer类的典型用法代码示例。如果您正苦于以下问题:Java IRetryAnalyzer类的具体用法?Java IRetryAnalyzer怎么用?Java IRetryAnalyzer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IRetryAnalyzer类属于org.testng包,在下文中一共展示了IRetryAnalyzer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: transform
import org.testng.IRetryAnalyzer; //导入依赖的package包/类
@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);
}
}
示例2: onTestFailure
import org.testng.IRetryAnalyzer; //导入依赖的package包/类
@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);
}
示例3: transform
import org.testng.IRetryAnalyzer; //导入依赖的package包/类
@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]));
}
}
}
示例4: transform
import org.testng.IRetryAnalyzer; //导入依赖的package包/类
@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);
}
}
示例5: transform
import org.testng.IRetryAnalyzer; //导入依赖的package包/类
@Override
public void transform(ITestAnnotation annotation, Class testClass, Constructor testConstructor, Method testMethod) {
IRetryAnalyzer retry = annotation.getRetryAnalyzer();
if (retry == null) {
annotation.setRetryAnalyzer(TestngRetry.class);
}
}
示例6: transform
import org.testng.IRetryAnalyzer; //导入依赖的package包/类
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);
}
}
示例7: transform
import org.testng.IRetryAnalyzer; //导入依赖的package包/类
public void transform(ITestAnnotation annotation, Class testClass,
Constructor testConstructor, Method testMethod) {
IRetryAnalyzer analyzer = annotation.getRetryAnalyzer();
if (analyzer == null) {
annotation.setRetryAnalyzer(FailedTestsRetryListner.class);
}
}
示例8: onTestStart
import org.testng.IRetryAnalyzer; //导入依赖的package包/类
/**
*
* @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);
}
}
}
示例9: onTestFailure
import org.testng.IRetryAnalyzer; //导入依赖的package包/类
/**
*
* @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);
// }
// }
}
示例10: onTestSkipped
import org.testng.IRetryAnalyzer; //导入依赖的package包/类
@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();
}
}
示例11: transform
import org.testng.IRetryAnalyzer; //导入依赖的package包/类
@Override
public void transform(ITestAnnotation iTestAnnotation,
Class aClass, Constructor constructor, Method method) {
IRetryAnalyzer retry = iTestAnnotation.getRetryAnalyzer();
if (retry == null) {
iTestAnnotation.setRetryAnalyzer(Retry.class);
}
}
示例12: getIRA
import org.testng.IRetryAnalyzer; //导入依赖的package包/类
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;
}
示例13: transform
import org.testng.IRetryAnalyzer; //导入依赖的package包/类
@Override
public void transform(ITestAnnotation annotation, Class testClass, Constructor constructor, Method method) {
IRetryAnalyzer retry = annotation.getRetryAnalyzer();
if(retry == null) {
annotation.setRetryAnalyzer(RetryFailed.class);
}
}
示例14: transform
import org.testng.IRetryAnalyzer; //导入依赖的package包/类
@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());
}
示例15: getRetryAnalyzer
import org.testng.IRetryAnalyzer; //导入依赖的package包/类
@Override
public IRetryAnalyzer getRetryAnalyzer()
{
return delegate.getRetryAnalyzer();
}