Top Inners Fields Constructors Methods
org.testng.internal.invokers

pack-priv Class TestInvoker

extends BaseInvoker
implements ITestInvoker
Class Inheritance
All Implemented Interfaces
org.testng.internal.invokers.ITestInvoker
Static Imports
org.testng.internal.invokers.InvokedMethodListenerMethod.AFTER_INVOCATION, .InvokedMethodListenerMethod.BEFORE_INVOCATION, .Invoker.CAN_RUN_FROM_CLASS, org.testng.internal.invokers.ParameterHandler.*

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
private static class

Field Summary

Modifier and TypeField and Description
private final DataProviderHolder
private static final AutoCloseableLock
private final ConfigInvoker
private final List<IClassListener>
private final boolean
Inherited from org.testng.internal.invokers.BaseInvoker:
m_classInvocationResultsm_configurationm_notifierm_suiteStatem_testContextNULL_OBJECT

Constructor Summary

AccessConstructor and Description
public
TestInvoker(ITestResultNotifier m_notifier, ITestContext m_testContext, SuiteRunState m_suiteState, IConfiguration m_configuration, Collection<IInvokedMethodListener> m_invokedMethodListeners, DataProviderHolder holder, List<IClassListener> m_classListeners, boolean m_skipFailedInvocationCounts, ConfigInvoker invoker, ISuiteRunnerListener suiteRunner)

Method Summary

Modifier and TypeMethod and Description
private DataProviderHolder
private String

Returns:

error message or null if dependencies have been run successfully
checkDependencies
(ITestNGMethod
test method being checked for
testMethod
)

Checks to see of the test method has certain dependencies that prevents TestNG from executing it

private static void
private void
private TestInvoker.StatusHolder
private TestInvoker.StatusHolder
private Collection<IDataProviderListener>
private boolean
public ITestResultNotifier
private void
handleInvocationResult(ITestNGMethod testMethod, ITestResult testResult, ITestInvoker.FailureContext failure, TestInvoker.StatusHolder holder, boolean willRetry)

public void
private ITestResult
private List<ITestResult>
invokePooledTestMethods(ITestNGMethod testMethod, Map<String, String> parameters, ConfigurationGroupMethods groupMethods, ITestContext testContext)

Invokes a method that has a specified threadPoolSize.

public ITestResult
invokeTestMethod(TestMethodArguments arguments, XmlSuite suite, ITestInvoker.FailureContext failureContext)

Implements org.testng.internal.invokers.ITestInvoker.invokeTestMethod.

invokeTestMethods() eventually converge here to invoke a single @Test method.
public List<ITestResult>
private Set<ITestResult>

Returns:

the test results that apply to one of the instances of the testMethod.
keepSameInstances
(ITestNGMethod method, Set<ITestResult> results)

public ITestResult
public ITestInvoker.FailureContext
private void
private void
private void
runConfigMethods(TestMethodArguments arguments, XmlSuite suite, ITestResult testResult, ITestNGMethod[] teardownConfigMethods)

public void
private List<ITestResult>
runWorkers(ITestNGMethod testMethod, List<IWorker<ITestNGMethod>> workers, int threadPoolSize, ConfigurationGroupMethods groupMethods, Map<String, 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 static void
setTestStatus(ITestResult result, int status)

private boolean
private static void
Inherited from org.testng.internal.invokers.BaseInvoker:
annotationFinderhandleExceptionisSkipExceptionAndSkiplogrunInvokedMethodListeners

Field Detail

holderback to summary
private final DataProviderHolder holder
internalLockback to summary
private static final AutoCloseableLock internalLock
invokerback to summary
private final ConfigInvoker invoker
m_classListenersback to summary
private final List<IClassListener> m_classListeners
m_skipFailedInvocationCountsback to summary
private final boolean m_skipFailedInvocationCounts

Constructor Detail

TestInvokerback to summary
public TestInvoker(ITestResultNotifier m_notifier, ITestContext m_testContext, SuiteRunState m_suiteState, IConfiguration m_configuration, Collection<IInvokedMethodListener> m_invokedMethodListeners, DataProviderHolder holder, List<IClassListener> m_classListeners, boolean m_skipFailedInvocationCounts, ConfigInvoker invoker, ISuiteRunnerListener suiteRunner)

Method Detail

buildDataProviderHolderback to summary
private DataProviderHolder buildDataProviderHolder()
checkDependenciesback to summary
private String checkDependencies(ITestNGMethod testMethod)

Checks to see of the test method has certain dependencies that prevents TestNG from executing it

Parameters
testMethod:ITestNGMethod

test method being checked for

Returns:String

error message or null if dependencies have been run successfully

cleanInterruptStatusback to summary
private static void cleanInterruptStatus()
collectResultsback to summary
private void collectResults(ITestNGMethod testMethod, ITestResult result)
considerExceptionsback to summary
private TestInvoker.StatusHolder considerExceptions(ITestNGMethod tm, ITestResult testResult, ExpectedExceptionsHolder exceptionsHolder, ITestInvoker.FailureContext failure)
considerExceptionsInternalback to summary
private TestInvoker.StatusHolder considerExceptionsInternal(ITestNGMethod tm, ITestResult testResult, ExpectedExceptionsHolder exceptionsHolder, ITestInvoker.FailureContext failure)
dataProviderListenersback to summary
private Collection<IDataProviderListener> dataProviderListeners()
failuresPresentInUpstreamDependencyback to summary
private boolean failuresPresentInUpstreamDependency(ITestNGMethod testMethod, ITestNGMethod[] methods)
getNotifierback to summary
public ITestResultNotifier getNotifier()

Implements org.testng.internal.invokers.ITestInvoker.getNotifier.

Annotations
@Override
handleInvocationResultback to summary
private void handleInvocationResult(ITestNGMethod testMethod, ITestResult testResult, ITestInvoker.FailureContext failure, TestInvoker.StatusHolder holder, boolean willRetry)
invokeListenersForSkippedTestResultback to summary
public void invokeListenersForSkippedTestResult(ITestResult r, IInvokedMethod invokedMethod)

Implements org.testng.internal.invokers.ITestInvoker.invokeListenersForSkippedTestResult.

invokeMethodback to summary
private ITestResult invokeMethod(TestMethodArguments arguments, XmlSuite suite, ITestInvoker.FailureContext failureContext)
invokePooledTestMethodsback to summary
private List<ITestResult> invokePooledTestMethods(ITestNGMethod testMethod, Map<String, String> parameters, ConfigurationGroupMethods groupMethods, ITestContext testContext)

Invokes a method that has a specified threadPoolSize.

invokeTestMethodback to summary
public ITestResult invokeTestMethod(TestMethodArguments arguments, XmlSuite suite, ITestInvoker.FailureContext failureContext)

Implements org.testng.internal.invokers.ITestInvoker.invokeTestMethod.

invokeTestMethods() eventually converge here to invoke a single @Test method.

This method is responsible for actually invoking the method. It decides if the invocation must be done:

  • through an IHookable
  • directly (through reflection)
  • in a separate thread (in case it needs to timeout)

This method is also responsible for invoking @BeforeGroup, @BeforeMethod, @AfterMethod, @AfterGroup if it is the case for the passed in @Test method.

invokeTestMethodsback to summary
public List<ITestResult> invokeTestMethods(ITestNGMethod testMethod, ConfigurationGroupMethods groupMethods, Object instance, ITestContext context)

Implements org.testng.internal.invokers.ITestInvoker.invokeTestMethods.

keepSameInstancesback to summary
private Set<ITestResult> keepSameInstances(ITestNGMethod method, Set<ITestResult> results)
Returns:Set<ITestResult>

the test results that apply to one of the instances of the testMethod.

registerSkippedTestResultback to summary
public ITestResult registerSkippedTestResult(ITestNGMethod testMethod, long start, Throwable throwable, ITestResult source)

Implements org.testng.internal.invokers.ITestInvoker.registerSkippedTestResult.

Annotations
@Override
retryFailedback to summary
public ITestInvoker.FailureContext retryFailed(TestMethodArguments arguments, List<ITestResult> result, int failureCount, ITestContext testContext)

Implements org.testng.internal.invokers.ITestInvoker.retryFailed.

runAfterConfigurationsback to summary
private void runAfterConfigurations(TestMethodArguments arguments, XmlSuite suite, ITestResult testResult)
runAfterGroupsConfigurationsback to summary
private void runAfterGroupsConfigurations(TestMethodArguments arguments)
runConfigMethodsback to summary
private void runConfigMethods(TestMethodArguments arguments, XmlSuite suite, ITestResult testResult, ITestNGMethod[] teardownConfigMethods)
runTestResultListenerback to summary
public void runTestResultListener(ITestResult tr)

Implements org.testng.internal.invokers.ITestInvoker.runTestResultListener.

runWorkersback to summary
private List<ITestResult> runWorkers(ITestNGMethod testMethod, List<IWorker<ITestNGMethod>> workers, int threadPoolSize, ConfigurationGroupMethods groupMethods, Map<String, 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.

setTestStatusback to summary
private static void setTestStatus(ITestResult result, int status)
shouldRetryTestMethodback to summary
private boolean shouldRetryTestMethod(ITestNGMethod testMethod, ITestResult testResult, ITestInvoker.FailureContext failure, TestInvoker.StatusHolder holder)
updateStatusHolderAccordingToTestResultback to summary
private static void updateStatusHolderAccordingToTestResult(ITestResult testResult, TestInvoker.StatusHolder holder)
org.testng.internal.invokers back to summary

private Class TestInvoker.MethodInvocationAgent

extends Object
Class Inheritance
  • java.lang.Object
  • org.testng.internal.invokers.TestInvoker.MethodInvocationAgent

Field Summary

Modifier and TypeField and Description
private final TestMethodArguments
private final ITestContext
private final ITestInvoker.FailureContext
private final ITestInvoker
private final List<ITestResult>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public List<ITestResult>
public int
invoke(int invCount)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

argumentsback to summary
private final TestMethodArguments arguments
contextback to summary
private final ITestContext context
failureback to summary
private final ITestInvoker.FailureContext failure
invokerback to summary
private final ITestInvoker invoker
resultback to summary
private final List<ITestResult> result

Constructor Detail

MethodInvocationAgentback to summary
public MethodInvocationAgent(TestMethodArguments arguments, ITestInvoker invoker, ITestContext context)

Method Detail

getResultback to summary
public List<ITestResult> getResult()
invokeback to summary
public int invoke(int invCount)
org.testng.internal.invokers back to summary

private Class TestInvoker.StatusHolder

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv boolean
pack-priv int
pack-priv int

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

handledback to summary
pack-priv boolean handled
originalStatusback to summary
pack-priv int originalStatus
statusback to summary
pack-priv int status

Constructor Detail

StatusHolderback to summary
private StatusHolder()