Modifier and Type | Class and Description |
---|---|
(package private) static class |
Invoker.CanRunFromClassPredicate |
(package private) static class |
Invoker.FailureContext |
(package private) static interface |
Invoker.Predicate<K,T> |
(package private) static class |
Invoker.SameClassNamePredicate |
private static class |
Invoker.StatusHolder |
Modifier and Type | Field and Description |
---|---|
private static Invoker.Predicate<ITestNGMethod,IClass> |
CAN_RUN_FROM_CLASS
Predicate to filter methods
|
private IAnnotationFinder |
m_annotationFinder |
private java.util.Map<java.lang.String,java.lang.Boolean> |
m_beforegroupsFailures
Group failures must be synced as the Invoker is accessed concurrently
|
private java.util.Map<java.lang.Class<?>,java.util.Set<java.lang.Object>> |
m_classInvocationResults
Class failures must be synced as the Invoker is accessed concurrently
|
private java.util.List<IClassListener> |
m_classListeners |
private IConfiguration |
m_configuration |
private boolean |
m_continueOnFailedConfiguration |
private java.util.Collection<IDataProviderListener> |
m_dataproviderListeners |
private java.util.Collection<IInvokedMethodListener> |
m_invokedMethodListeners |
private java.util.Map<ITestNGMethod,java.util.Set<java.lang.Object>> |
m_methodInvocationResults
Test methods whose configuration methods have failed.
|
private ITestResultNotifier |
m_notifier |
private boolean |
m_skipFailedInvocationCounts |
private SuiteRunState |
m_suiteState |
private ITestContext |
m_testContext |
private static Invoker.Predicate<ITestNGMethod,IClass> |
SAME_CLASS
Predicate to filter methods
|
Constructor and Description |
---|
Invoker(IConfiguration configuration,
ITestContext testContext,
ITestResultNotifier notifier,
SuiteRunState state,
boolean skipFailedInvocationCounts,
java.util.Collection<IInvokedMethodListener> invokedMethodListeners,
java.util.List<IClassListener> classListeners,
java.util.Collection<IDataProviderListener> dataProviderListeners) |
Modifier and Type | Method and Description |
---|---|
private java.lang.String |
checkDependencies(ITestNGMethod testMethod,
ITestNGMethod[] allTestMethods)
Checks to see of the test method has certain dependencies that prevents
TestNG from executing it
|
private boolean |
classConfigurationFailed(java.lang.Class<?> cls,
java.lang.Object instance) |
private void |
collectResults(ITestNGMethod testMethod,
ITestResult result) |
private IConfigurable |
computeConfigurableInstance(ConstructorOrMethod method,
java.lang.Object targetInstance) |
private static java.lang.Object |
computeInstance(java.lang.Object instance,
java.lang.Object inst,
ITestNGMethod tm) |
private static int |
computeTestStatusComparingTestResultAndStatusHolder(ITestResult testResult,
Invoker.StatusHolder holder,
boolean wasResultUnaltered) |
private boolean |
confInvocationPassed(ITestNGMethod method,
ITestNGMethod currentTestMethod,
IClass testClass,
java.lang.Object instance) |
private Invoker.StatusHolder |
considerExceptions(ITestNGMethod tm,
ITestResult testresult,
ExpectedExceptionsHolder exceptionsHolder,
Invoker.FailureContext failure) |
private java.util.Set<java.lang.Object> |
getInvocationResults(IClass testClass) |
private void |
handleConfigurationFailure(java.lang.Throwable ite,
ITestNGMethod tm,
ITestResult testResult,
IConfigurationAnnotation annotation,
ITestNGMethod currentTestMethod,
java.lang.Object instance,
XmlSuite suite) |
private void |
handleConfigurationSkip(ITestNGMethod tm,
ITestResult testResult,
IConfigurationAnnotation annotation,
ITestNGMethod currentTestMethod,
java.lang.Object instance,
XmlSuite suite)
Marks the current
TestResult as skipped and invokes the listeners. |
private void |
handleException(java.lang.Throwable throwable,
ITestNGMethod testMethod,
ITestResult testResult,
int failureCount)
An exception was thrown by the test, determine if this method
should be marked as a failure or as failure_but_within_successPercentage
|
private void |
handleInvocationResults(ITestNGMethod testMethod,
ITestResult testResult,
Invoker.FailureContext failure,
Invoker.StatusHolder holder,
boolean wasResultUnaltered) |
private boolean |
hasConfigFailure(ITestNGMethod currentTestMethod) |
private boolean |
haveBeenRunSuccessfully(ITestNGMethod testMethod,
ITestNGMethod[] methods) |
private void |
invokeAfterGroupsConfigurations(ITestNGMethod currentTestMethod,
ConfigurationGroupMethods groupMethods,
XmlSuite suite,
java.util.Map<java.lang.String,java.lang.String> params,
java.lang.Object instance) |
private void |
invokeBeforeGroupsConfigurations(ITestNGMethod currentTestMethod,
ConfigurationGroupMethods groupMethods,
XmlSuite suite,
java.util.Map<java.lang.String,java.lang.String> params,
java.lang.Object instance)
Filter all the beforeGroups methods and invoke only those that apply
to the current test method
|
private void |
invokeConfigurationMethod(java.lang.Object targetInstance,
ITestNGMethod tm,
java.lang.Object[] params,
ITestResult testResult)
Effectively invokes a configuration method on all passed in instances.
|
void |
invokeConfigurations(IClass testClass,
ITestNGMethod[] allMethods,
XmlSuite suite,
java.util.Map<java.lang.String,java.lang.String> params,
java.lang.Object[] parameterValues,
java.lang.Object instance)
Invoke configuration methods if they belong to the same TestClass passed
in parameter..
|
private void |
invokeConfigurations(IClass testClass,
ITestNGMethod currentTestMethod,
ITestNGMethod[] allMethods,
XmlSuite suite,
java.util.Map<java.lang.String,java.lang.String> params,
java.lang.Object[] parameterValues,
java.lang.Object instance,
ITestResult testMethodResult) |
private ITestResult |
invokeMethod(java.lang.Object instance,
ITestNGMethod tm,
java.lang.Object[] parameterValues,
int parametersIndex,
XmlSuite suite,
java.util.Map<java.lang.String,java.lang.String> params,
ITestClass testClass,
ITestNGMethod[] beforeMethods,
ITestNGMethod[] afterMethods,
ConfigurationGroupMethods groupMethods,
Invoker.FailureContext failureContext) |
private java.util.List<ITestResult> |
invokePooledTestMethods(ITestNGMethod testMethod,
XmlSuite suite,
java.util.Map<java.lang.String,java.lang.String> parameters,
ConfigurationGroupMethods groupMethods,
ITestContext testContext)
Invokes a method that has a specified threadPoolSize.
|
(package private) ITestResult |
invokeTestMethod(java.lang.Object instance,
ITestNGMethod tm,
java.lang.Object[] parameterValues,
int parametersIndex,
XmlSuite suite,
java.util.Map<java.lang.String,java.lang.String> params,
ITestClass testClass,
ITestNGMethod[] beforeMethods,
ITestNGMethod[] afterMethods,
ConfigurationGroupMethods groupMethods,
Invoker.FailureContext failureContext)
invokeTestMethods() eventually converge here to invoke a single @Test method.
|
java.util.List<ITestResult> |
invokeTestMethods(ITestNGMethod testMethod,
XmlSuite suite,
java.util.Map<java.lang.String,java.lang.String> testParameters,
ConfigurationGroupMethods groupMethods,
java.lang.Object instance,
ITestContext testContext)
Invoke all the test methods.
|
private boolean |
isSkipExceptionAndSkip(java.lang.Throwable ite) |
private java.util.Set<ITestResult> |
keepSameInstances(ITestNGMethod method,
java.util.Set<ITestResult> results) |
private void |
log(int level,
java.lang.String s) |
private boolean |
noListenersPresent() |
private void |
recordConfigurationInvocationFailed(ITestNGMethod tm,
IClass testClass,
IConfigurationAnnotation annotation,
ITestNGMethod currentTestMethod,
java.lang.Object instance,
XmlSuite suite)
Record internally the failure of a Configuration, so that we can determine
later if @Test should be skipped.
|
private ITestResult |
registerSkippedTestResult(ITestNGMethod testMethod,
java.lang.Object instance,
long start,
java.lang.Throwable throwable) |
(package private) int |
retryFailed(java.lang.Object instance,
ITestNGMethod tm,
XmlSuite suite,
ITestClass testClass,
ITestNGMethod[] beforeMethods,
ITestNGMethod[] afterMethods,
ConfigurationGroupMethods groupMethods,
java.util.List<ITestResult> result,
int failureCount,
ITestContext testContext,
java.util.Map<java.lang.String,java.lang.String> parameters,
int parametersIndex) |
private void |
runConfigurationListeners(ITestResult tr,
boolean before) |
private void |
runInvokedMethodListeners(InvokedMethodListenerMethod listenerMethod,
IInvokedMethod invokedMethod,
ITestResult testResult) |
(package private) void |
runTestListeners(ITestResult tr) |
private java.util.List<ITestResult> |
runWorkers(ITestNGMethod testMethod,
java.util.List<IWorker<ITestNGMethod>> workers,
int threadPoolSize,
ConfigurationGroupMethods groupMethods,
XmlSuite suite,
java.util.Map<java.lang.String,java.lang.String> parameters)
To reduce thread contention and also to correctly handle thread-confinement
this method invokes the @BeforeGroups and @AfterGroups corresponding to the current @Test method.
|
private void |
setClassInvocationFailure(java.lang.Class<?> clazz,
java.lang.Object instance) |
private void |
setMethodInvocationFailure(ITestNGMethod method,
java.lang.Object instance) |
private static void |
setTestStatus(ITestResult result,
int status) |
private void |
throwConfigurationFailure(ITestResult testResult,
java.lang.Throwable ex) |
private final ITestContext m_testContext
private final ITestResultNotifier m_notifier
private final IAnnotationFinder m_annotationFinder
private final SuiteRunState m_suiteState
private final boolean m_skipFailedInvocationCounts
private final java.util.Collection<IInvokedMethodListener> m_invokedMethodListeners
private final boolean m_continueOnFailedConfiguration
private final java.util.List<IClassListener> m_classListeners
private final java.util.Collection<IDataProviderListener> m_dataproviderListeners
private final java.util.Map<java.lang.String,java.lang.Boolean> m_beforegroupsFailures
private final java.util.Map<java.lang.Class<?>,java.util.Set<java.lang.Object>> m_classInvocationResults
private final java.util.Map<ITestNGMethod,java.util.Set<java.lang.Object>> m_methodInvocationResults
private IConfiguration m_configuration
private static final Invoker.Predicate<ITestNGMethod,IClass> CAN_RUN_FROM_CLASS
private static final Invoker.Predicate<ITestNGMethod,IClass> SAME_CLASS
public Invoker(IConfiguration configuration, ITestContext testContext, ITestResultNotifier notifier, SuiteRunState state, boolean skipFailedInvocationCounts, java.util.Collection<IInvokedMethodListener> invokedMethodListeners, java.util.List<IClassListener> classListeners, java.util.Collection<IDataProviderListener> dataProviderListeners)
private void setClassInvocationFailure(java.lang.Class<?> clazz, java.lang.Object instance)
private void setMethodInvocationFailure(ITestNGMethod method, java.lang.Object instance)
public void invokeConfigurations(IClass testClass, ITestNGMethod[] allMethods, XmlSuite suite, java.util.Map<java.lang.String,java.lang.String> params, java.lang.Object[] parameterValues, java.lang.Object instance)
invokeConfigurations
in interface IInvoker
testClass
- the class whose configuration methods must be runprivate void invokeConfigurations(IClass testClass, ITestNGMethod currentTestMethod, ITestNGMethod[] allMethods, XmlSuite suite, java.util.Map<java.lang.String,java.lang.String> params, java.lang.Object[] parameterValues, java.lang.Object instance, ITestResult testMethodResult)
private static java.lang.Object computeInstance(java.lang.Object instance, java.lang.Object inst, ITestNGMethod tm)
private void handleConfigurationSkip(ITestNGMethod tm, ITestResult testResult, IConfigurationAnnotation annotation, ITestNGMethod currentTestMethod, java.lang.Object instance, XmlSuite suite)
TestResult
as skipped and invokes the listeners.private void handleConfigurationFailure(java.lang.Throwable ite, ITestNGMethod tm, ITestResult testResult, IConfigurationAnnotation annotation, ITestNGMethod currentTestMethod, java.lang.Object instance, XmlSuite suite)
private void recordConfigurationInvocationFailed(ITestNGMethod tm, IClass testClass, IConfigurationAnnotation annotation, ITestNGMethod currentTestMethod, java.lang.Object instance, XmlSuite suite)
private boolean classConfigurationFailed(java.lang.Class<?> cls, java.lang.Object instance)
private boolean confInvocationPassed(ITestNGMethod method, ITestNGMethod currentTestMethod, IClass testClass, java.lang.Object instance)
private boolean hasConfigFailure(ITestNGMethod currentTestMethod)
private java.util.Set<java.lang.Object> getInvocationResults(IClass testClass)
private void invokeConfigurationMethod(java.lang.Object targetInstance, ITestNGMethod tm, java.lang.Object[] params, ITestResult testResult) throws java.lang.reflect.InvocationTargetException, java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
java.lang.IllegalAccessException
private IConfigurable computeConfigurableInstance(ConstructorOrMethod method, java.lang.Object targetInstance)
private void throwConfigurationFailure(ITestResult testResult, java.lang.Throwable ex)
private void runInvokedMethodListeners(InvokedMethodListenerMethod listenerMethod, IInvokedMethod invokedMethod, ITestResult testResult)
private boolean noListenersPresent()
private ITestResult invokeMethod(java.lang.Object instance, ITestNGMethod tm, java.lang.Object[] parameterValues, int parametersIndex, XmlSuite suite, java.util.Map<java.lang.String,java.lang.String> params, ITestClass testClass, ITestNGMethod[] beforeMethods, ITestNGMethod[] afterMethods, ConfigurationGroupMethods groupMethods, Invoker.FailureContext failureContext)
private static void setTestStatus(ITestResult result, int status)
private void collectResults(ITestNGMethod testMethod, ITestResult result)
ITestResult invokeTestMethod(java.lang.Object instance, ITestNGMethod tm, java.lang.Object[] parameterValues, int parametersIndex, XmlSuite suite, java.util.Map<java.lang.String,java.lang.String> params, ITestClass testClass, ITestNGMethod[] beforeMethods, ITestNGMethod[] afterMethods, ConfigurationGroupMethods groupMethods, Invoker.FailureContext failureContext)
IHookable
private void invokeBeforeGroupsConfigurations(ITestNGMethod currentTestMethod, ConfigurationGroupMethods groupMethods, XmlSuite suite, java.util.Map<java.lang.String,java.lang.String> params, java.lang.Object instance)
private void invokeAfterGroupsConfigurations(ITestNGMethod currentTestMethod, ConfigurationGroupMethods groupMethods, XmlSuite suite, java.util.Map<java.lang.String,java.lang.String> params, java.lang.Object instance)
int retryFailed(java.lang.Object instance, ITestNGMethod tm, XmlSuite suite, ITestClass testClass, ITestNGMethod[] beforeMethods, ITestNGMethod[] afterMethods, ConfigurationGroupMethods groupMethods, java.util.List<ITestResult> result, int failureCount, ITestContext testContext, java.util.Map<java.lang.String,java.lang.String> parameters, int parametersIndex)
public java.util.List<ITestResult> invokeTestMethods(ITestNGMethod testMethod, XmlSuite suite, java.util.Map<java.lang.String,java.lang.String> testParameters, ConfigurationGroupMethods groupMethods, java.lang.Object instance, ITestContext testContext)
invokeTestMethod(Object, ITestNGMethod, Object[], int, XmlSuite, Map, ITestClass, ITestNGMethod[], ITestNGMethod[], ConfigurationGroupMethods, FailureContext)
and this would simplify the implementation (see how DataTestMethodWorker is used)invokeTestMethods
in interface IInvoker
private ITestResult registerSkippedTestResult(ITestNGMethod testMethod, java.lang.Object instance, long start, java.lang.Throwable throwable)
private java.util.List<ITestResult> invokePooledTestMethods(ITestNGMethod testMethod, XmlSuite suite, java.util.Map<java.lang.String,java.lang.String> parameters, ConfigurationGroupMethods groupMethods, ITestContext testContext)
private Invoker.StatusHolder considerExceptions(ITestNGMethod tm, ITestResult testresult, ExpectedExceptionsHolder exceptionsHolder, Invoker.FailureContext failure)
private void handleInvocationResults(ITestNGMethod testMethod, ITestResult testResult, Invoker.FailureContext failure, Invoker.StatusHolder holder, boolean wasResultUnaltered)
private static int computeTestStatusComparingTestResultAndStatusHolder(ITestResult testResult, Invoker.StatusHolder holder, boolean wasResultUnaltered)
private boolean isSkipExceptionAndSkip(java.lang.Throwable ite)
private java.util.List<ITestResult> runWorkers(ITestNGMethod testMethod, java.util.List<IWorker<ITestNGMethod>> workers, int threadPoolSize, ConfigurationGroupMethods groupMethods, XmlSuite suite, java.util.Map<java.lang.String,java.lang.String> parameters)
private java.lang.String checkDependencies(ITestNGMethod testMethod, ITestNGMethod[] allTestMethods)
testMethod
- test method being checked forprivate java.util.Set<ITestResult> keepSameInstances(ITestNGMethod method, java.util.Set<ITestResult> results)
private boolean haveBeenRunSuccessfully(ITestNGMethod testMethod, ITestNGMethod[] methods)
private void handleException(java.lang.Throwable throwable, ITestNGMethod testMethod, ITestResult testResult, int failureCount)
private void runConfigurationListeners(ITestResult tr, boolean before)
void runTestListeners(ITestResult tr)
private void log(int level, java.lang.String s)