org.testng.internal
Class Invoker
java.lang.Object
org.testng.internal.Invoker
- All Implemented Interfaces:
- IInvoker
public class Invoker
- extends java.lang.Object
- implements IInvoker
This class is responsible for invoking methods:
- test methods
- configuration methods
- possibly in a separate thread
and then for notifying the result listeners.
- Author:
- Cedric Beust, Alexandru Popescu
Method Summary |
void |
invokeConfigurations(IClass testClass,
ITestNGMethod[] allMethods,
XmlSuite suite,
java.util.Map<java.lang.String,java.lang.String> params,
java.lang.Object instance)
Invoke configuration methods if they belong to the same TestClass passed
in parameter.. |
java.util.List<ITestResult> |
invokeTestMethods(ITestNGMethod testMethod,
ITestNGMethod[] allTestMethods,
int testMethodIndex,
XmlSuite suite,
java.util.Map<java.lang.String,java.lang.String> parameters,
ConfigurationGroupMethods groupMethods,
java.lang.Object[] instances,
ITestContext testContext)
Invoke all the test methods. |
static void |
runTestListeners(ITestResult tr,
java.util.List<ITestListener> listeners)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Invoker
public Invoker(ITestContext testContext,
ITestResultNotifier notifier,
SuiteRunState state,
IAnnotationFinder annotationFinder,
boolean skipFailedInvocationCounts)
invokeConfigurations
public void invokeConfigurations(IClass testClass,
ITestNGMethod[] allMethods,
XmlSuite suite,
java.util.Map<java.lang.String,java.lang.String> params,
java.lang.Object instance)
- Invoke configuration methods if they belong to the same TestClass passed
in parameter.. TODO: Calculate ahead of time which methods should be
invoked for each class. Might speed things up for users who invoke the
same test class with different parameters in the same suite run.
If instance is non-null, the configuration will be run on it. If it is null,
the configuration methods will be run on all the instances retrieved
from the ITestClass.
- Specified by:
invokeConfigurations
in interface IInvoker
- Parameters:
testClass
- the class whose configuration methods must be run
invokeTestMethods
public java.util.List<ITestResult> invokeTestMethods(ITestNGMethod testMethod,
ITestNGMethod[] allTestMethods,
int testMethodIndex,
XmlSuite suite,
java.util.Map<java.lang.String,java.lang.String> parameters,
ConfigurationGroupMethods groupMethods,
java.lang.Object[] instances,
ITestContext testContext)
- Invoke all the test methods. Note the plural: the method passed in
parameter might be invoked several times if the test class it belongs
to has more than one instance (i.e., if an @Factory method has been
declared somewhere that returns several instances of this TestClass).
If no @Factory method was specified, testMethod will only be invoked
once.
Note that this method also takes care of invoking the beforeTestMethod
and afterTestMethod, if any.
Note (alex): this method can be refactored to use a SingleTestMethodWorker that
directly invokes
invokeTestMethod(Object[], ITestNGMethod, Object[], XmlSuite, Map, ITestClass, ITestNGMethod[], ITestNGMethod[], ConfigurationGroupMethods)
and this would simplify the implementation (see how DataTestMethodWorker is used)
- Specified by:
invokeTestMethods
in interface IInvoker
allTestMethods
- The list of all the test methodstestMethodIndex
- The index of testMethod in the allTestMethods array
- Returns:
- a list containing the results of the test methods invocations
runTestListeners
public static void runTestListeners(ITestResult tr,
java.util.List<ITestListener> listeners)
Copyright © 2010. All Rights Reserved.