當前位置: 首頁>>代碼示例>>Java>>正文


Java ITestResult.getMethod方法代碼示例

本文整理匯總了Java中org.testng.ITestResult.getMethod方法的典型用法代碼示例。如果您正苦於以下問題:Java ITestResult.getMethod方法的具體用法?Java ITestResult.getMethod怎麽用?Java ITestResult.getMethod使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.testng.ITestResult的用法示例。


在下文中一共展示了ITestResult.getMethod方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onTestSkipped

import org.testng.ITestResult; //導入方法依賴的package包/類
/**
 * [ITestListener]
 * Invoked each time a test is skipped.
 *
 * @param result {@code ITestResult} containing information about the run test
 * @see ITestResult#SKIP
 */
@Override
public void onTestSkipped(ITestResult result) {
    
    // >>>>> ENTER workaround for TestNG bug
    // https://github.com/cbeust/testng/issues/1602
    ITestContext context = result.getTestContext();
    IInvokedMethod method = new InvokedMethod(
                    result.getTestClass(), result.getMethod(), System.currentTimeMillis(), result);
    
    beforeInvocation(method, result, context);
    // <<<<< LEAVE workaround for TestNG bug
    
    synchronized (testListeners) {
        for (ITestListener testListener : testListeners) {
            testListener.onTestSkipped(result);
        }
    }
}
 
開發者ID:Nordstrom,項目名稱:TestNG-Foundation,代碼行數:26,代碼來源:ListenerChain.java

示例2: getTestName

import org.testng.ITestResult; //導入方法依賴的package包/類
private String getTestName(ITestResult tr) {
    ITestNGMethod method = tr.getMethod();
    return method.getMethodName();
}
 
開發者ID:adobe,項目名稱:stock-api-sdk,代碼行數:5,代碼來源:TestCustomLogger.java

示例3: resultDetail

import org.testng.ITestResult; //導入方法依賴的package包/類
private void resultDetail(IResultMap tests) {
	for (ITestResult result : tests.getAllResults()) {
		ITestNGMethod method = result.getMethod();

		int methodId = getId(result);

		String cname = method.getTestClass().getName();
		m_out.println("<h2 id=\"m" + methodId + "\" name=\"m" + methodId + "\" >" + cname + ":"
				+ method.getMethodName() + "</h2>");
		Set<ITestResult> resultSet = tests.getResults(method);
		generateForResult(result, method, resultSet.size());
		m_out.println("<p class=\"totop\"><a href=\"#summary\">back to summary</a></p>");

	}
}
 
開發者ID:quanqinle,項目名稱:WebAndAppUITesting,代碼行數:16,代碼來源:PowerEmailableReporter.java

示例4: onTestStart

import org.testng.ITestResult; //導入方法依賴的package包/類
@Override
@SuppressWarnings({"Indentation", "PMD.ExcessiveMethodLength"})
public void onTestStart(final ITestResult testResult) {
    Current current = currentTestResult.get();
    if (current.isStarted()) {
        current = refreshContext();
    }
    current.test();
    final String parentUuid = getUniqueUuid(testResult.getTestContext());
    final ITestNGMethod method = testResult.getMethod();
    final ITestClass testClass = method.getTestClass();
    final List<Label> labels = new ArrayList<>();
    labels.addAll(Arrays.asList(
            //Packages grouping
            new Label().withName("package").withValue(testClass.getName()),
            new Label().withName("testClass").withValue(testClass.getName()),
            new Label().withName("testMethod").withValue(method.getMethodName()),

            //xUnit grouping
            new Label().withName("parentSuite").withValue(safeExtractSuiteName(testClass)),
            new Label().withName("suite").withValue(safeExtractTestTag(testClass)),
            new Label().withName("subSuite").withValue(safeExtractTestClassName(testClass)),

            //Timeline grouping
            new Label().withName("host").withValue(getHostName()),
            new Label().withName("thread").withValue(getThreadName())
    ));
    labels.addAll(getLabels(testResult));
    final List<Parameter> parameters = getParameters(testResult);
    final TestResult result = new TestResult()
            .withUuid(current.getUuid())
            .withHistoryId(getHistoryId(method, parameters))
            .withName(getMethodName(method))
            .withFullName(getQualifiedName(method))
            .withStatusDetails(new StatusDetails()
                    .withFlaky(isFlaky(testResult))
                    .withMuted(isMuted(testResult)))
            .withParameters(parameters)
            .withLinks(getLinks(testResult))
            .withLabels(labels);
    processDescription(getClass().getClassLoader(), method.getConstructorOrMethod().getMethod(), result);
    getLifecycle().scheduleTestCase(parentUuid, result);
    getLifecycle().startTestCase(current.getUuid());

    final String uuid = current.getUuid();
    Optional.of(testResult)
            .map(ITestResult::getMethod)
            .map(ITestNGMethod::getTestClass)
            .map(classContainerUuidStorage::get)
            .ifPresent(testClassContainerUuid -> getLifecycle().updateTestContainer(
                    testClassContainerUuid,
                    container -> container.getChildren().add(uuid)
            ));
}
 
開發者ID:allure-framework,項目名稱:allure-java,代碼行數:55,代碼來源:AllureTestNg.java


注:本文中的org.testng.ITestResult.getMethod方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。