本文整理匯總了Java中org.testng.ITestResult.getInstance方法的典型用法代碼示例。如果您正苦於以下問題:Java ITestResult.getInstance方法的具體用法?Java ITestResult.getInstance怎麽用?Java ITestResult.getInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.testng.ITestResult
的用法示例。
在下文中一共展示了ITestResult.getInstance方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: afterInvocation
import org.testng.ITestResult; //導入方法依賴的package包/類
@Override
public void afterInvocation(IInvokedMethod method, ITestResult testResult) {
if (testResult.getInstance() instanceof IInvokedMethodListenerEx) {
((IInvokedMethodListenerEx) testResult.getInstance()).afterInvocation(method, testResult);
}
if (method.getTestMethod().isBeforeMethodConfiguration()) {
// merge with attributes from prior methods
Map<String, Object> attributes = fromBefore.get();
attributes.putAll(PropertyManager.extractAttributes(testResult));
fromBefore.set(attributes);
} else if (method.isTestMethod()) {
fromMethod.set(PropertyManager.extractAttributes(testResult));
} else if (method.getTestMethod().isAfterMethodConfiguration()) {
// nothing to do here
}
}
示例2: beforeInvocation
import org.testng.ITestResult; //導入方法依賴的package包/類
@Override
public void beforeInvocation(IInvokedMethod method, ITestResult testResult) {
if (method.getTestMethod().isBeforeMethodConfiguration()) {
// nothing to do here
} else if (method.isTestMethod()) {
PropertyManager.injectAttributes(fromBefore.get(), testResult);
fromBefore.remove();
} else if (method.getTestMethod().isAfterMethodConfiguration()) {
PropertyManager.injectAttributes(fromMethod.get(), testResult);
fromMethod.remove();
}
if (testResult.getInstance() instanceof IInvokedMethodListenerEx) {
((IInvokedMethodListenerEx) testResult.getInstance()).beforeInvocation(method, testResult);
}
}
示例3: afterInvocation
import org.testng.ITestResult; //導入方法依賴的package包/類
/**
* Perform post-invocation processing:
* <ul>
* <li>If indicated, close the driver that was acquired for this method.</li>
* </ul>
*
* @param invokedMethod an object representing the method that's just been invoked
* @param testResult test result object for the method that's just been invoked
*/
@Override
public void afterInvocation(IInvokedMethod invokedMethod, ITestResult testResult) {
// ensure current test result is set
Reporter.setCurrentTestResult(testResult);
Object obj = testResult.getInstance();
Method method = invokedMethod.getTestMethod().getConstructorOrMethod().getMethod();
DriverManager.afterInvocation(obj, method);
}
示例4: beforeInvocation
import org.testng.ITestResult; //導入方法依賴的package包/類
/**
* Perform pre-invocation processing:
* <ul>
* <li>Ensure that a driver instance has been created for the test.</li>
* <li>Store the driver instance for subsequent dispensing.</li>
* <li>Manage configured driver timeout intervals.</li>
* <li>If specified, open the initial page, storing the page object for subsequent dispensing.</li>
* </ul>
*
* @param invokedMethod an object representing the method that's about to be invoked
* @param testResult test result object for the method that's about to be invoked
*/
@Override
public void beforeInvocation(IInvokedMethod invokedMethod, ITestResult testResult) {
// ensure current test result is set
Reporter.setCurrentTestResult(testResult);
Object obj = testResult.getInstance();
Method method = invokedMethod.getTestMethod().getConstructorOrMethod().getMethod();
DriverManager.beforeInvocation(obj, method);
}