class TestInvoker extends BaseInvoker implements ITestInvoker
Modifier and Type | Class and Description |
---|---|
private class |
TestInvoker.MethodInvocationAgent |
private static class |
TestInvoker.StatusHolder |
ITestInvoker.FailureContext
Modifier and Type | Field and Description |
---|---|
private ConfigInvoker |
invoker |
private java.util.List<IClassListener> |
m_classListeners |
private java.util.Collection<IDataProviderListener> |
m_dataproviderListeners |
private boolean |
m_skipFailedInvocationCounts |
m_classInvocationResults, m_configuration, m_notifier, m_suiteState, m_testContext
Constructor and Description |
---|
TestInvoker(ITestResultNotifier m_notifier,
ITestContext m_testContext,
SuiteRunState m_suiteState,
IConfiguration m_configuration,
java.util.Collection<IInvokedMethodListener> m_invokedMethodListeners,
java.util.Collection<IDataProviderListener> m_dataproviderListeners,
java.util.List<IClassListener> m_classListeners,
boolean m_skipFailedInvocationCounts,
ConfigInvoker invoker) |
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 void |
collectResults(ITestNGMethod testMethod,
ITestResult result) |
private static int |
computeTestStatusComparingTestResultAndStatusHolder(ITestResult testResult,
TestInvoker.StatusHolder holder,
boolean wasResultUnaltered) |
private TestInvoker.StatusHolder |
considerExceptions(ITestNGMethod tm,
ITestResult testresult,
ExpectedExceptionsHolder exceptionsHolder,
ITestInvoker.FailureContext failure) |
private java.util.Collection<IDataProviderListener> |
dataProviderListeners() |
private boolean |
failuresPresentInUpstreamDependency(ITestNGMethod testMethod,
ITestNGMethod[] methods) |
ITestResultNotifier |
getNotifier() |
private void |
handleInvocationResults(ITestNGMethod testMethod,
ITestResult testResult,
ITestInvoker.FailureContext failure,
TestInvoker.StatusHolder holder,
boolean wasResultUnaltered) |
void |
invokeListenersForSkippedTestResult(ITestResult r,
IInvokedMethod invokedMethod) |
private ITestResult |
invokeMethod(TestMethodArguments arguments,
XmlSuite suite,
ITestInvoker.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.
|
ITestResult |
invokeTestMethod(TestMethodArguments arguments,
XmlSuite suite,
ITestInvoker.FailureContext failureContext)
invokeTestMethods() eventually converge here to invoke a single @Test method.
|
java.util.List<ITestResult> |
invokeTestMethods(ITestNGMethod testMethod,
ConfigurationGroupMethods groupMethods,
java.lang.Object instance,
ITestContext context) |
private java.util.Set<ITestResult> |
keepSameInstances(ITestNGMethod method,
java.util.Set<ITestResult> results) |
ITestResult |
registerSkippedTestResult(ITestNGMethod testMethod,
long start,
java.lang.Throwable throwable) |
ITestInvoker.FailureContext |
retryFailed(TestMethodArguments arguments,
java.util.List<ITestResult> result,
int failureCount,
ITestContext testContext) |
private void |
runAfterGroupsConfigurations(TestMethodArguments arguments,
XmlSuite suite,
TestResult testResult) |
private void |
runConfigMethods(TestMethodArguments arguments,
XmlSuite suite,
TestResult testResult,
ITestNGMethod[] teardownConfigMethods) |
void |
runTestResultListener(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 static void |
setTestStatus(ITestResult result,
int status) |
annotationFinder, handleException, isSkipExceptionAndSkip, log, runInvokedMethodListeners
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getRunner
private final ConfigInvoker invoker
private final java.util.Collection<IDataProviderListener> m_dataproviderListeners
private final java.util.List<IClassListener> m_classListeners
private final boolean m_skipFailedInvocationCounts
public TestInvoker(ITestResultNotifier m_notifier, ITestContext m_testContext, SuiteRunState m_suiteState, IConfiguration m_configuration, java.util.Collection<IInvokedMethodListener> m_invokedMethodListeners, java.util.Collection<IDataProviderListener> m_dataproviderListeners, java.util.List<IClassListener> m_classListeners, boolean m_skipFailedInvocationCounts, ConfigInvoker invoker)
public ITestResultNotifier getNotifier()
getNotifier
in interface ITestInvoker
public java.util.List<ITestResult> invokeTestMethods(ITestNGMethod testMethod, ConfigurationGroupMethods groupMethods, java.lang.Object instance, ITestContext context)
invokeTestMethods
in interface ITestInvoker
public ITestResult invokeTestMethod(TestMethodArguments arguments, XmlSuite suite, ITestInvoker.FailureContext failureContext)
This method is responsible for actually invoking the method. It decides if the invocation must be done:
IHookable
This method is also responsible for invoking @BeforeGroup, @BeforeMethod, @AfterMethod, @AfterGroup if it is the case for the passed in @Test method.
invokeTestMethod
in interface ITestInvoker
public ITestInvoker.FailureContext retryFailed(TestMethodArguments arguments, java.util.List<ITestResult> result, int failureCount, ITestContext testContext)
retryFailed
in interface ITestInvoker
public void runTestResultListener(ITestResult tr)
runTestResultListener
in interface ITestInvoker
private java.util.Collection<IDataProviderListener> dataProviderListeners()
private java.lang.String checkDependencies(ITestNGMethod testMethod, ITestNGMethod[] allTestMethods)
testMethod
- test method being checked forprivate 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 boolean failuresPresentInUpstreamDependency(ITestNGMethod testMethod, ITestNGMethod[] methods)
private java.util.Set<ITestResult> keepSameInstances(ITestNGMethod method, java.util.Set<ITestResult> results)
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 void collectResults(ITestNGMethod testMethod, ITestResult result)
public void invokeListenersForSkippedTestResult(ITestResult r, IInvokedMethod invokedMethod)
invokeListenersForSkippedTestResult
in interface ITestInvoker
private static void setTestStatus(ITestResult result, int status)
private void handleInvocationResults(ITestNGMethod testMethod, ITestResult testResult, ITestInvoker.FailureContext failure, TestInvoker.StatusHolder holder, boolean wasResultUnaltered)
private ITestResult invokeMethod(TestMethodArguments arguments, XmlSuite suite, ITestInvoker.FailureContext failureContext)
private void runAfterGroupsConfigurations(TestMethodArguments arguments, XmlSuite suite, TestResult testResult)
private void runConfigMethods(TestMethodArguments arguments, XmlSuite suite, TestResult testResult, ITestNGMethod[] teardownConfigMethods)
public ITestResult registerSkippedTestResult(ITestNGMethod testMethod, long start, java.lang.Throwable throwable)
registerSkippedTestResult
in interface ITestInvoker
private TestInvoker.StatusHolder considerExceptions(ITestNGMethod tm, ITestResult testresult, ExpectedExceptionsHolder exceptionsHolder, ITestInvoker.FailureContext failure)
private static int computeTestStatusComparingTestResultAndStatusHolder(ITestResult testResult, TestInvoker.StatusHolder holder, boolean wasResultUnaltered)