assert null != testMethod.getTestClass()
: "COULDN'T FIND TESTCLASS FOR " + testMethod.getMethod().getDeclaringClass();
List<ITestResult> result = Lists.newArrayList();
ITestClass testClass= testMethod.getTestClass();
long start= System.currentTimeMillis();
//
// TODO:
// - [DONE] revisit invocationCount, threadPoolSize values
// - try to remove the isWithinThreadedMethod: still needed to determine the @BeforeMethod + @AfterMethod
// - [DONE] solve the results different approaches: assignment and addAll
//
// For invocationCount>1 and threadPoolSize>1 the method will be invoked on a thread pool
long timeOutInvocationCount = testMethod.getInvocationTimeOut();
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, testClass, allTestMethods);
if (okToProceed) {
//
// Invoke the test method if it's enabled
//
if (MethodHelper.isEnabled(testMethod.getMethod(), m_annotationFinder)) {
//
// If threadPoolSize specified, run this method in its own pool thread.
//
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());
ITestNGMethod[] afterMethods = filterMethods(testClass, testClass.getAfterTestMethods());
Map<String, String> allParameterNames = Maps.newHashMap();
ParameterBag bag = createParameters(testClass, testMethod,
parameters, allParameterNames, null, suite, testContext, instances[0],