当前位置: 首页>>代码示例>>Java>>正文


Java ITestResult.isSuccess方法代码示例

本文整理汇总了Java中org.testng.ITestResult.isSuccess方法的典型用法代码示例。如果您正苦于以下问题:Java ITestResult.isSuccess方法的具体用法?Java ITestResult.isSuccess怎么用?Java ITestResult.isSuccess使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.testng.ITestResult的用法示例。


在下文中一共展示了ITestResult.isSuccess方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: afterInvocation

import org.testng.ITestResult; //导入方法依赖的package包/类
@Override
public void afterInvocation(final IInvokedMethod method, final ITestResult testResult,
                            final ITestContext context) {
    final ITestNGMethod testMethod = method.getTestMethod();
    if (isSupportedConfigurationFixture(testMethod)) {
        final String executableUuid = currentExecutable.get();
        currentExecutable.remove();
        if (testResult.isSuccess()) {
            getLifecycle().updateFixture(executableUuid, result -> result.withStatus(Status.PASSED));
        } else {
            getLifecycle().updateFixture(executableUuid, result -> result
                    .withStatus(getStatus(testResult.getThrowable()))
                    .withStatusDetails(getStatusDetails(testResult.getThrowable()).orElse(null)));
        }
        getLifecycle().stopFixture(executableUuid);

        if (testMethod.isBeforeMethodConfiguration() || testMethod.isAfterMethodConfiguration()) {
            final String containerUuid = currentTestContainer.get();
            validateContainerExists(getQualifiedName(testMethod), containerUuid);
            currentTestContainer.remove();
            getLifecycle().stopTestContainer(containerUuid);
            getLifecycle().writeTestContainer(containerUuid);
        }
    }
}
 
开发者ID:allure-framework,项目名称:allure-java,代码行数:26,代码来源:AllureTestNg.java

示例2: afterInvocation

import org.testng.ITestResult; //导入方法依赖的package包/类
@Override
public void afterInvocation(IInvokedMethod method, ITestResult testResult) {
    if (method.isTestMethod() && !testResult.isSuccess()) {
            attachScreenshot();
    }
}
 
开发者ID:endless-qa,项目名称:webdriver-examples-java,代码行数:7,代码来源:BaseListener.java

示例3: retryMethod

import org.testng.ITestResult; //导入方法依赖的package包/类
@Override
public boolean retryMethod(ITestResult result) {
    boolean willRetry = !result.isSuccess();
    if (willRetry) {
        result.setAttribute("retry", true);
    }
    return willRetry;
}
 
开发者ID:allure-framework,项目名称:allure-java,代码行数:9,代码来源:RetryTest.java

示例4: retry

import org.testng.ITestResult; //导入方法依赖的package包/类
/**
 * If a testcase is failed and if baseUrl is not pingable, retry the test case.
 */
@Override
public boolean retry(ITestResult testResult)
{
    LOG.info("@EnvAwareRetryAnalyzer retry");
    String maxRetryStr = (String) testResult.getTestContext().getAttribute("maxRetryCount");
    if (null != maxRetryStr)
    {
        try
        {
            maxRetryCount = Integer.valueOf(maxRetryStr);
        } catch (NumberFormatException e)
        {
            e.printStackTrace();
            maxRetryCount = 3;
        }
    } else
    {
        maxRetryCount = 3;
    }

    if (!testResult.isSuccess() && (retryCount++ < maxRetryCount))
    {
        String message = testResult.getThrowable().getMessage().toLowerCase();
        if (message.contains("time-out"))
        {
            LOG.info("Retrying for time out... ");
            return true;
        }
    }
    return false;
}
 
开发者ID:basavaraj1985,项目名称:DolphinNG,代码行数:35,代码来源:TimeoutRetryAnalyzer.java

示例5: afterMethod

import org.testng.ITestResult; //导入方法依赖的package包/类
@AfterMethod
public void afterMethod(ITestResult result) {
	System.out.println("BaseCase: afterMethod");
	String testClassName = String.format("%s.%s", result.getMethod()
               .getRealClass().getName().toString(), result.getMethod().getMethodName());
	System.out.println("---->"+testClassName);
	if (!result.isSuccess()) {
		Log.fail(result.getThrowable());
	}
	Log.info("==============����ִ�����==============");
	if(Log.isPass()){
		TestReport.successCount ++;
	}else{
		if(LogConfig.retryTimes > 0){
			
			try {
				Class<?> c = Class.forName(result.getMethod().getRealClass().getName());
				Method m =   c.getMethod(result.getMethod().getMethodName());
				while(retryCounter < LogConfig.retryTimes){
					Log.flush();
					Log.info("<<<<<<<<<<<<<<<<<< ��ʼ����ִ��\""+ result.getMethod().getMethodName() +"\"���� >>>>>>>>>>>>>>>>>>");
					m.invoke(c.newInstance(), (Object[])null);
					Log.info("<<<<<<<<<<<<<<<<<< ����ִ��\""+ result.getMethod().getMethodName() +"\"������� >>>>>>>>>>>>>>>>>>");
					retryCounter ++;
				}
			} catch (Exception e) {						
				e.printStackTrace();
			}
			if(retryCounter >= LogConfig.retryTimes) {
				retryCounter = 0;//��ʼ��
				TestReport.failureCount ++;
			}
		}else{
			TestReport.failureCount ++;
		}
	}
	
	Log.commit();
}
 
开发者ID:AlanYangs,项目名称:Log4Reports,代码行数:40,代码来源:BaseCase.java

示例6: retry

import org.testng.ITestResult; //导入方法依赖的package包/类
@Override
public synchronized boolean retry(ITestResult result) {
	//Failed and parameters has not retry.
	if (!result.isSuccess() && !hasRetried(result.getParameters())) {
		log.info("Retry method [" + result.getMethod().getMethodName() + "] with parameters:"
				+ Arrays.toString(result.getParameters()));
		result.setStatus(ITestResult.SKIP);
		paramsHasRetried.add(result.getParameters());
		return true;
	}
	return false;
}
 
开发者ID:21ca,项目名称:selenium-testng-template,代码行数:13,代码来源:TestngRetryOnce.java

示例7: retry

import org.testng.ITestResult; //导入方法依赖的package包/类
@Override
public synchronized boolean retry(ITestResult result) {
	//Failed and parameters has not retry.
	if (!result.isSuccess() && getRetriedCount(result) < retryCount) {
		log.info("Retry method [" + result.getMethod().getMethodName() + "] with parameters:"
				+ Arrays.toString(result.getParameters()));
		result.setStatus(ITestResult.SKIP);
		increaseRetryCount(result);
		return true;
	}
	return false;
}
 
开发者ID:21ca,项目名称:selenium-testng-template,代码行数:13,代码来源:TestngRetry.java

示例8: afterInvocation

import org.testng.ITestResult; //导入方法依赖的package包/类
@Override
public void afterInvocation(final IInvokedMethod method, final ITestResult testResult) {
    if (method.isTestMethod()) {
        addByteAttachmentAsync("Test log", "text/plain", "afterInvocationContent"::getBytes);

        if (!testResult.isSuccess()) {
            addStreamAttachmentAsync("Failure screenshot", "image/png", () ->
                    getSystemResourceAsStream("attachments/screenshot.png"));
        }
    }
}
 
开发者ID:sskorol,项目名称:allure2-testng-report,代码行数:12,代码来源:BaseListener.java

示例9: after

import org.testng.ITestResult; //导入方法依赖的package包/类
@AfterMethod
public void after(ITestResult result) {
    if (!result.isSuccess()) {
        List<Object> list = new ArrayList<>();
        Collections.addAll(list, result.getParameters());
        list.add(context.toString());
        result.setParameters(list.toArray(new Object[list.size()]));
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:LoggingTestCase.java

示例10: copyErrors

import org.testng.ITestResult; //导入方法依赖的package包/类
@AfterMethod
public void copyErrors(ITestResult result) {
    if (!result.isSuccess()) {
        suiteErrors.addAll(diags.errorKeys());

        List<Object> list = new ArrayList<>();
        Collections.addAll(list, result.getParameters());
        list.add("Test case: " + getTestCaseDescription());
        for (Pair<String, Template> e : sourceFiles)
            list.add("Source file " + e.fst + ": " + e.snd);
        if (diags.errorsFound())
            list.add("Compile diagnostics: " + diags.toString());
        result.setParameters(list.toArray(new Object[list.size()]));
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:JavacTemplateTestBase.java


注:本文中的org.testng.ITestResult.isSuccess方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。