Package org.testng.internal
Class ConfigInvoker
java.lang.Object
org.testng.internal.BaseInvoker
org.testng.internal.ConfigInvoker
- All Implemented Interfaces:
IConfigInvoker
-
Field Summary
FieldsModifier and TypeFieldDescriptionGroup failures must be synced as the Invoker is accessed concurrentlyprivate final boolean
private final Set<ITestNGMethod>
protected final Map<ITestNGMethod,
Set<Object>> Test methods whose configuration methods have failed.Fields inherited from class org.testng.internal.BaseInvoker
m_classInvocationResults, m_configuration, m_notifier, m_suiteState, m_testContext
-
Constructor Summary
ConstructorsConstructorDescriptionConfigInvoker
(ITestResultNotifier notifier, Collection<IInvokedMethodListener> invokedMethodListeners, ITestContext testContext, SuiteRunState suiteState, IConfiguration configuration) -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
classConfigurationFailed
(Class<?> cls, Object instance) private IConfigurable
computeConfigurableInstance
(ConstructorOrMethod method, Object targetInstance) private static Object
computeInstance
(Object instance, Object inst, ITestNGMethod tm) private static void
copyAttributesFromNativelyInjectedTestResult
(Object[] source, ITestResult target) getInvocationResults
(IClass testClass) 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 currentTestResult
as skipped and invokes the listeners.private boolean
hasConfigFailure
(ITestNGMethod currentTestMethod) boolean
hasConfigurationFailureFor
(ITestNGMethod testNGMethod, String[] groups, IClass testClass, Object instance) void
void
Filter all the beforeGroups methods and invoke only those that apply to the current test methodprivate void
invokeConfigurationMethod
(Object targetInstance, ITestNGMethod tm, Object[] params, ITestResult testResult) Effectively invokes a configuration method on all passed in instances.void
invokeConfigurations
(ConfigMethodArguments arguments) 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
runConfigurationListeners
(ITestResult tr, ITestNGMethod tm, boolean before) private void
setClassInvocationFailure
(Class<?> clazz, Object instance) private void
setMethodInvocationFailure
(ITestNGMethod method, Object instance) private void
throwConfigurationFailure
(ITestResult testResult, Throwable ex) Methods inherited from class org.testng.internal.BaseInvoker
annotationFinder, handleException, isSkipExceptionAndSkip, log, runInvokedMethodListeners
-
Field Details
-
m_methodInvocationResults
Test methods whose configuration methods have failed. -
m_continueOnFailedConfiguration
private final boolean m_continueOnFailedConfiguration -
m_executedConfigMethods
-
m_beforegroupsFailures
Group failures must be synced as the Invoker is accessed concurrently
-
-
Constructor Details
-
ConfigInvoker
public ConfigInvoker(ITestResultNotifier notifier, Collection<IInvokedMethodListener> invokedMethodListeners, ITestContext testContext, SuiteRunState suiteState, IConfiguration configuration)
-
-
Method Details
-
hasConfigurationFailureFor
public boolean hasConfigurationFailureFor(ITestNGMethod testNGMethod, String[] groups, IClass testClass, Object instance) - Specified by:
hasConfigurationFailureFor
in interfaceIConfigInvoker
- Returns:
- false if this class has successfully run all its @Configuration method or true if at least one of these methods failed.
-
invokeBeforeGroupsConfigurations
Filter all the beforeGroups methods and invoke only those that apply to the current test method- Specified by:
invokeBeforeGroupsConfigurations
in interfaceIConfigInvoker
- Parameters:
arguments
- - AGroupConfigMethodArguments
object.
-
isGroupLevelConfigurationMethod
-
invokeAfterGroupsConfigurations
- Specified by:
invokeAfterGroupsConfigurations
in interfaceIConfigInvoker
-
invokeConfigurations
- Specified by:
invokeConfigurations
in interfaceIConfigInvoker
-
invokeConfigurationMethod
private void invokeConfigurationMethod(Object targetInstance, ITestNGMethod tm, Object[] params, ITestResult testResult) throws InvocationTargetException, IllegalAccessException Effectively invokes a configuration method on all passed in instances. -
throwConfigurationFailure
-
computeConfigurableInstance
private IConfigurable computeConfigurableInstance(ConstructorOrMethod method, Object targetInstance) -
runConfigurationListeners
-
handleConfigurationSkip
private void handleConfigurationSkip(ITestNGMethod tm, ITestResult testResult, IConfigurationAnnotation annotation, ITestNGMethod currentTestMethod, Object instance, XmlSuite suite) Marks the currentTestResult
as skipped and invokes the listeners. -
hasConfigFailure
-
handleConfigurationFailure
private void handleConfigurationFailure(Throwable ite, ITestNGMethod tm, ITestResult testResult, IConfigurationAnnotation annotation, ITestNGMethod currentTestMethod, Object instance, XmlSuite suite) -
isConfigMethodEligibleForScrutiny
-
classConfigurationFailed
- Returns:
- true if this class or a parent class failed to initialize.
-
copyAttributesFromNativelyInjectedTestResult
private static void copyAttributesFromNativelyInjectedTestResult(Object[] source, ITestResult target) -
setMethodInvocationFailure
-
setClassInvocationFailure
-
recordConfigurationInvocationFailed
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. -
computeInstance
-
getInvocationResults
-