當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。