Top Fields Constructors Methods
org.testng.internal.invokers

pack-priv Class ConfigInvoker

extends BaseInvoker
implements IConfigInvoker
Class Inheritance
All Implemented Interfaces
org.testng.internal.invokers.IConfigInvoker
Static Imports
org.testng.internal.invokers.InvokedMethodListenerMethod.AFTER_INVOCATION, .InvokedMethodListenerMethod.BEFORE_INVOCATION, .Invoker.SAME_CLASS

Field Summary

Modifier and TypeField and Description
private final IConfigurationListener
private final AutoCloseableLock
private final Map<String, Boolean>
m_beforegroupsFailures

Group failures must be synced as the Invoker is accessed concurrently

private final boolean
private final Set<ITestNGMethod>
private boolean
private boolean
private boolean
protected final Map<ITestNGMethod, Set<Object>>
m_methodInvocationResults

Test methods whose configuration methods have failed.

Inherited from org.testng.internal.invokers.BaseInvoker:
m_classInvocationResultsm_configurationm_notifierm_suiteStatem_testContextNULL_OBJECT

Constructor Summary

AccessConstructor and Description
public
ConfigInvoker(ITestResultNotifier notifier, Collection<IInvokedMethodListener> invokedMethodListeners, ITestContext testContext, SuiteRunState suiteState, IConfiguration configuration, IConfigurationListener internalConfigurationListener, ISuiteRunnerListener suiteRunner)

Method Summary

Modifier and TypeMethod and Description
private static boolean
private boolean
canIgnoreConfigFailure(IClass testClass, ITestNGMethod configMethod)

private boolean

Returns:

true if this class or a parent class failed to initialize.
classConfigurationFailed
(Class<?> cls, Object instance)

private IConfigurable
private static Object
private static void
public IConfiguration
private Set<Object>
private void
handleConfigurationFailure(Throwable ite, ITestNGMethod tm, ITestResult testResult, IConfigurationAnnotation annotation, ITestNGMethod currentTestMethod, Object instance, XmlSuite suite)

private void
handleConfigurationSkip(ITestNGMethod tm, ITestResult testResult, IConfigurationAnnotation annotation, ITestNGMethod currentTestMethod, Object instance, XmlSuite suite)

Marks the current TestResult as skipped and invokes the listeners.

private boolean
hasConfigFailure(ITestNGMethod currentTestMethod)

public boolean

Returns:

false if this class has successfully run all its @Configuration method or true if at least one of these methods failed.
hasConfigurationFailureFor
(ITestNGMethod testNGMethod, String[] groups, IClass testClass, Object instance)

Implements org.testng.internal.invokers.IConfigInvoker.hasConfigurationFailureFor.

public boolean
public void
public void
invokeBeforeGroupsConfigurations(GroupConfigMethodArguments arguments)

Implements org.testng.internal.invokers.IConfigInvoker.invokeBeforeGroupsConfigurations.

Filter all the beforeGroups methods and invoke only those that apply to the current test method
private void
invokeConfigurationMethod(Object targetInstance, ITestNGMethod tm, Object[] params, ITestResult testResult)

Effectively invokes a configuration method on all passed in instances.

public void
private static boolean
private static boolean
private void
recordConfigurationInvocationFailed(ITestNGMethod tm, IClass testClass, IConfigurationAnnotation annotation, ITestNGMethod currentTestMethod, Object instance, XmlSuite suite)

Record internally the failure of a Configuration, so that we can determine later if @Test should be skipped.

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

Field Detail

internalConfigurationListenerback to summary
private final IConfigurationListener internalConfigurationListener
internalLockback to summary
private final AutoCloseableLock internalLock
m_beforegroupsFailuresback to summary
private final Map<String, Boolean> m_beforegroupsFailures

Group failures must be synced as the Invoker is accessed concurrently

m_continueOnFailedConfigurationback to summary
private final boolean m_continueOnFailedConfiguration
m_executedConfigMethodsback to summary
private final Set<ITestNGMethod> m_executedConfigMethods
m_hasClassLevelFailuresback to summary
private boolean m_hasClassLevelFailures
m_hasTestMethodLevelFailuresback to summary
private boolean m_hasTestMethodLevelFailures
m_hasTestTagLevelFailuresback to summary
private boolean m_hasTestTagLevelFailures
m_methodInvocationResultsback to summary
protected final Map<ITestNGMethod, Set<Object>> m_methodInvocationResults

Test methods whose configuration methods have failed.

Constructor Detail

ConfigInvokerback to summary
public ConfigInvoker(ITestResultNotifier notifier, Collection<IInvokedMethodListener> invokedMethodListeners, ITestContext testContext, SuiteRunState suiteState, IConfiguration configuration, IConfigurationListener internalConfigurationListener, ISuiteRunnerListener suiteRunner)

Method Detail

canIgnoreConfigFailureback to summary
private static boolean canIgnoreConfigFailure(ITestNGMethod method)
canIgnoreConfigFailureback to summary
private boolean canIgnoreConfigFailure(IClass testClass, ITestNGMethod configMethod)
classConfigurationFailedback to summary
private boolean classConfigurationFailed(Class<?> cls, Object instance)
Returns:boolean

true if this class or a parent class failed to initialize.

computeConfigurableInstanceback to summary
private IConfigurable computeConfigurableInstance(ConstructorOrMethod method, Object targetInstance)
computeInstanceback to summary
private static Object computeInstance(Object instance, Object inst, ITestNGMethod tm)
copyAttributesFromNativelyInjectedTestResultback to summary
private static void copyAttributesFromNativelyInjectedTestResult(Object[] source, ITestResult target)
getConfigurationback to summary
public IConfiguration getConfiguration()

Implements org.testng.internal.invokers.IConfigInvoker.getConfiguration.

Annotations
@Override
getInvocationResultsback to summary
private Set<Object> getInvocationResults(IClass testClass)
handleConfigurationFailureback to summary
private void handleConfigurationFailure(Throwable ite, ITestNGMethod tm, ITestResult testResult, IConfigurationAnnotation annotation, ITestNGMethod currentTestMethod, Object instance, XmlSuite suite)
handleConfigurationSkipback to summary
private void handleConfigurationSkip(ITestNGMethod tm, ITestResult testResult, IConfigurationAnnotation annotation, ITestNGMethod currentTestMethod, Object instance, XmlSuite suite)

Marks the current TestResult as skipped and invokes the listeners.

hasConfigFailureback to summary
private boolean hasConfigFailure(ITestNGMethod currentTestMethod)
hasConfigurationFailureForback to summary
public boolean hasConfigurationFailureFor(ITestNGMethod testNGMethod, String[] groups, IClass testClass, Object instance)

Implements org.testng.internal.invokers.IConfigInvoker.hasConfigurationFailureFor.

Returns:boolean

false if this class has successfully run all its @Configuration method or true if at least one of these methods failed.

hasConfigurationFailureForback to summary
public boolean hasConfigurationFailureFor(ITestNGMethod configMethod, ITestNGMethod testNGMethod, String[] groups, IClass testClass, Object instance)

Implements org.testng.internal.invokers.IConfigInvoker.hasConfigurationFailureFor.

Annotations
@Override
invokeAfterGroupsConfigurationsback to summary
public void invokeAfterGroupsConfigurations(GroupConfigMethodArguments arguments)

Implements org.testng.internal.invokers.IConfigInvoker.invokeAfterGroupsConfigurations.

invokeBeforeGroupsConfigurationsback to summary
public void invokeBeforeGroupsConfigurations(GroupConfigMethodArguments arguments)

Implements org.testng.internal.invokers.IConfigInvoker.invokeBeforeGroupsConfigurations.

Filter all the beforeGroups methods and invoke only those that apply to the current test method

Parameters
arguments:GroupConfigMethodArguments

- A GroupConfigMethodArguments object.

invokeConfigurationMethodback to summary
private void invokeConfigurationMethod(Object targetInstance, ITestNGMethod tm, Object[] params, ITestResult testResult) throws InvocationTargetException, IllegalAccessException

Effectively invokes a configuration method on all passed in instances.

invokeConfigurationsback to summary
public void invokeConfigurations(ConfigMethodArguments arguments)

Implements org.testng.internal.invokers.IConfigInvoker.invokeConfigurations.

isConfigMethodEligibleForScrutinyback to summary
private static boolean isConfigMethodEligibleForScrutiny(ITestNGMethod tm)
isGroupLevelConfigurationMethodback to summary
private static boolean isGroupLevelConfigurationMethod(ITestNGMethod itm)
recordConfigurationInvocationFailedback to summary
private void recordConfigurationInvocationFailed(ITestNGMethod tm, IClass testClass, IConfigurationAnnotation annotation, ITestNGMethod currentTestMethod, Object instance, XmlSuite suite)

Record internally the failure of a Configuration, so that we can determine later if @Test should be skipped.

runConfigurationListenersback to summary
private void runConfigurationListeners(ITestResult tr, ITestNGMethod tm, boolean before)
setClassInvocationFailureback to summary
private void setClassInvocationFailure(Class<?> clazz, Object instance)
setMethodInvocationFailureback to summary
private void setMethodInvocationFailure(ITestNGMethod method, Object instance)
throwConfigurationFailureback to summary
private void throwConfigurationFailure(ITestResult testResult, Throwable ex)