Package org.testng.internal.invokers
Class ConfigInvoker
java.lang.Object
org.testng.internal.invokers.BaseInvoker
org.testng.internal.invokers.ConfigInvoker
- All Implemented Interfaces:
IConfigInvoker
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final IConfigurationListener
Group failures must be synced as the Invoker is accessed concurrentlyprivate final boolean
private final Set
<ITestNGMethod> private boolean
private boolean
private boolean
protected final Map
<ITestNGMethod, Set<Object>> Test methods whose configuration methods have failed.Fields inherited from class org.testng.internal.invokers.BaseInvoker
m_classInvocationResults, m_configuration, m_notifier, m_suiteState, m_testContext, NULL_OBJECT
-
Constructor Summary
ConstructorsConstructorDescriptionConfigInvoker
(ITestResultNotifier notifier, Collection<IInvokedMethodListener> invokedMethodListeners, ITestContext testContext, SuiteRunState suiteState, IConfiguration configuration, IConfigurationListener internalConfigurationListener, SuiteRunner suiteRunner) -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
canIgnoreConfigFailure
(IClass testClass, ITestNGMethod configMethod) private static boolean
canIgnoreConfigFailure
(ITestNGMethod method) private 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) boolean
hasConfigurationFailureFor
(ITestNGMethod configMethod, 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.invokers.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_hasTestTagLevelFailures
private boolean m_hasTestTagLevelFailures -
m_hasClassLevelFailures
private boolean m_hasClassLevelFailures -
m_hasTestMethodLevelFailures
private boolean m_hasTestMethodLevelFailures -
m_executedConfigMethods
-
m_beforegroupsFailures
Group failures must be synced as the Invoker is accessed concurrently -
internalConfigurationListener
-
-
Constructor Details
-
ConfigInvoker
public ConfigInvoker(ITestResultNotifier notifier, Collection<IInvokedMethodListener> invokedMethodListeners, ITestContext testContext, SuiteRunState suiteState, IConfiguration configuration, IConfigurationListener internalConfigurationListener, SuiteRunner suiteRunner)
-
-
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.
-
hasConfigurationFailureFor
public boolean hasConfigurationFailureFor(ITestNGMethod configMethod, ITestNGMethod testNGMethod, String[] groups, IClass testClass, Object instance) - Specified by:
hasConfigurationFailureFor
in interfaceIConfigInvoker
-
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
-
canIgnoreConfigFailure
-
canIgnoreConfigFailure
-