本文整理匯總了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)
));
}