本文整理汇总了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);
}
}
}
示例2: getTestName
import org.testng.ITestResult; //导入方法依赖的package包/类
private String getTestName(ITestResult tr) {
ITestNGMethod method = tr.getMethod();
return method.getMethodName();
}
示例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>");
}
}
示例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)
));
}