当前位置: 首页>>代码示例>>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;未经允许,请勿转载。