* return if the method is not enabled. No need to do any more calculations
*/
return result;
}
ITestClass testClass= testMethod.getTestClass();
long start = System.currentTimeMillis();
// For invocationCount > 1 and threadPoolSize > 1 the method will be invoked on a thread pool
long timeOutInvocationCount = testMethod.getInvocationTimeOut();
//FIXME: Is this correct?
boolean onlyOne = testMethod.getThreadPoolSize() > 1 ||
timeOutInvocationCount > 0;
int invocationCount = onlyOne ? 1 : testMethod.getInvocationCount();
int failureCount = 0;
ExpectedExceptionsHolder expectedExceptionHolder =
MethodHelper.findExpectedExceptions(m_annotationFinder, testMethod.getMethod());
while(invocationCount-- > 0) {
boolean okToProceed = checkDependencies(testMethod, allTestMethods);
if (!okToProceed) {
//
// Not okToProceed. Test is being skipped
//
ITestResult testResult = new TestResult(testClass, null /* instance */,
testMethod,
null /* cause */,
start,
System.currentTimeMillis(),
m_testContext);
String missingGroup = testMethod.getMissingGroup();
if (missingGroup != null) {
testResult.setThrowable(new Throwable("Method " + testMethod
+ " depends on nonexistent group \"" + missingGroup + "\""));
}
testResult.setStatus(ITestResult.SKIP);
result.add(testResult);
m_notifier.addSkippedTest(testMethod, testResult);
runTestListeners(testResult);
return result;
}
//
// If threadPoolSize specified, run this method in its own pool thread.
//
Map<String, String> parameters =
testMethod.findMethodParameters(testContext.getCurrentXmlTest());
if (testMethod.getThreadPoolSize() > 1 && testMethod.getInvocationCount() > 1) {
return invokePooledTestMethods(testMethod, allTestMethods, suite,
parameters, groupMethods, testContext);
}
//
// No threads, regular invocation
//
else {
ITestNGMethod[] beforeMethods = filterMethods(testClass, testClass.getBeforeTestMethods(),
CAN_RUN_FROM_CLASS);
ITestNGMethod[] afterMethods = filterMethods(testClass, testClass.getAfterTestMethods(),
CAN_RUN_FROM_CLASS);
Map<String, String> allParameterNames = Maps.newHashMap();
ParameterBag bag = createParameters(testMethod,
parameters, allParameterNames, null, suite, testContext, instances[0],