org.testng.internal
Class TestMethodWorker

java.lang.Object
  extended by org.testng.internal.TestMethodWorker
All Implemented Interfaces:
java.lang.Runnable, IMethodWorker

public class TestMethodWorker
extends java.lang.Object
implements IMethodWorker

FIXME: reduce contention when this class is used through parallel invocation due to invocationCount and threadPoolSize by not invoking the @BeforeClass and @AfterClass which are already invoked on the original method. This class implements Runnable and will invoke the ITestMethod passed in its constructor on its run() method.

Author:
Cedric Beust, Alexandru Popescu

Field Summary
protected  ITestNGMethod[] m_allTestMethods
           
protected  ClassMethodMap m_classMethodMap
           
protected  ConfigurationGroupMethods m_groupMethods
           
protected  IInvoker m_invoker
           
protected  java.util.Map<java.lang.String,java.lang.String> m_parameters
           
protected  XmlSuite m_suite
           
protected  IMethodInstance[] m_testMethods
           
protected  java.util.List<ITestResult> m_testResults
           
 
Constructor Summary
TestMethodWorker(IInvoker invoker, IMethodInstance[] testMethods, XmlSuite suite, java.util.Map<java.lang.String,java.lang.String> parameters, ITestNGMethod[] allTestMethods, ConfigurationGroupMethods groupMethods, ClassMethodMap classMethodMap, ITestContext testContext)
           
 
Method Summary
 long getMaxTimeOut()
          Retrieves the maximum specified timeout of all ITestNGMethods to be run.
 java.util.List<ITestResult> getTestResults()
           
protected  int indexOf(ITestNGMethod tm, ITestNGMethod[] allTestMethods)
           
protected  void invokeAfterClassMethods(ITestClass testClass, IMethodInstance mi)
           
protected  void invokeBeforeClassMethods(ITestClass testClass, IMethodInstance mi)
           
protected  void invokeTestMethods(ITestNGMethod tm, java.lang.Object[] instances, ITestContext testContext)
           
 void run()
          Run all the ITestNGMethods passed in through the constructor.
 void setAllTestMethods(ITestNGMethod[] allTestMethods)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_testMethods

protected IMethodInstance[] m_testMethods

m_invoker

protected IInvoker m_invoker

m_parameters

protected java.util.Map<java.lang.String,java.lang.String> m_parameters

m_suite

protected XmlSuite m_suite

m_allTestMethods

protected ITestNGMethod[] m_allTestMethods

m_testResults

protected java.util.List<ITestResult> m_testResults

m_groupMethods

protected ConfigurationGroupMethods m_groupMethods

m_classMethodMap

protected ClassMethodMap m_classMethodMap
Constructor Detail

TestMethodWorker

public TestMethodWorker(IInvoker invoker,
                        IMethodInstance[] testMethods,
                        XmlSuite suite,
                        java.util.Map<java.lang.String,java.lang.String> parameters,
                        ITestNGMethod[] allTestMethods,
                        ConfigurationGroupMethods groupMethods,
                        ClassMethodMap classMethodMap,
                        ITestContext testContext)
Method Detail

getMaxTimeOut

public long getMaxTimeOut()
Retrieves the maximum specified timeout of all ITestNGMethods to be run.

Specified by:
getMaxTimeOut in interface IMethodWorker
Returns:
the max timeout or 0 if no timeout was specified

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

run

public void run()
Run all the ITestNGMethods passed in through the constructor.

Specified by:
run in interface java.lang.Runnable
See Also:
Runnable.run()

invokeTestMethods

protected void invokeTestMethods(ITestNGMethod tm,
                                 java.lang.Object[] instances,
                                 ITestContext testContext)

invokeBeforeClassMethods

protected void invokeBeforeClassMethods(ITestClass testClass,
                                        IMethodInstance mi)

invokeAfterClassMethods

protected void invokeAfterClassMethods(ITestClass testClass,
                                       IMethodInstance mi)

indexOf

protected int indexOf(ITestNGMethod tm,
                      ITestNGMethod[] allTestMethods)

getTestResults

public java.util.List<ITestResult> getTestResults()
Specified by:
getTestResults in interface IMethodWorker

setAllTestMethods

public void setAllTestMethods(ITestNGMethod[] allTestMethods)


Copyright © 2010. All Rights Reserved.