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 IConfigurationListenerGroup failures must be synced as the Invoker is accessed concurrentlyprivate final booleanprivate final Set<ITestNGMethod> private booleanprivate booleanprivate booleanprotected 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 booleancanIgnoreConfigFailure(IClass testClass, ITestNGMethod configMethod) private static booleancanIgnoreConfigFailure(ITestNGMethod method) private booleanclassConfigurationFailed(Class<?> cls, Object instance) private IConfigurablecomputeConfigurableInstance(ConstructorOrMethod method, Object targetInstance) private static ObjectcomputeInstance(Object instance, Object inst, ITestNGMethod tm) private static voidcopyAttributesFromNativelyInjectedTestResult(Object[] source, ITestResult target) getInvocationResults(IClass testClass) private voidhandleConfigurationFailure(Throwable ite, ITestNGMethod tm, ITestResult testResult, IConfigurationAnnotation annotation, ITestNGMethod currentTestMethod, Object instance, XmlSuite suite) private voidhandleConfigurationSkip(ITestNGMethod tm, ITestResult testResult, IConfigurationAnnotation annotation, ITestNGMethod currentTestMethod, Object instance, XmlSuite suite) Marks the currentTestResultas skipped and invokes the listeners.private booleanhasConfigFailure(ITestNGMethod currentTestMethod) booleanhasConfigurationFailureFor(ITestNGMethod testNGMethod, String[] groups, IClass testClass, Object instance) booleanhasConfigurationFailureFor(ITestNGMethod configMethod, ITestNGMethod testNGMethod, String[] groups, IClass testClass, Object instance) voidvoidFilter all the beforeGroups methods and invoke only those that apply to the current test methodprivate voidinvokeConfigurationMethod(Object targetInstance, ITestNGMethod tm, Object[] params, ITestResult testResult) Effectively invokes a configuration method on all passed in instances.voidinvokeConfigurations(ConfigMethodArguments arguments) private static booleanprivate static booleanprivate voidrecordConfigurationInvocationFailed(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 voidrunConfigurationListeners(ITestResult tr, ITestNGMethod tm, boolean before) private voidsetClassInvocationFailure(Class<?> clazz, Object instance) private voidsetMethodInvocationFailure(ITestNGMethod method, Object instance) private voidthrowConfigurationFailure(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:
hasConfigurationFailureForin 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:
hasConfigurationFailureForin interfaceIConfigInvoker
-
invokeBeforeGroupsConfigurations
Filter all the beforeGroups methods and invoke only those that apply to the current test method- Specified by:
invokeBeforeGroupsConfigurationsin interfaceIConfigInvoker- Parameters:
arguments- - AGroupConfigMethodArgumentsobject.
-
isGroupLevelConfigurationMethod
-
invokeAfterGroupsConfigurations
- Specified by:
invokeAfterGroupsConfigurationsin interfaceIConfigInvoker
-
invokeConfigurations
- Specified by:
invokeConfigurationsin 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 currentTestResultas 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
-