Package org.testng
Class SuiteRunner
java.lang.Object
org.testng.SuiteRunner
- All Implemented Interfaces:
IAttributes
,ISuite
,ISuiteRunnerListener
SuiteRunner
is responsible for running all the tests included in one suite. The test
start is triggered by run()
method.-
Constructor Summary
ConstructorsModifierConstructorDescriptionSuiteRunner
(org.testng.internal.IConfiguration configuration, XmlSuite suite, String outputDir, ITestRunnerFactory runnerFactory, boolean useDefaultListeners, Comparator<ITestNGMethod> comparator) protected
SuiteRunner
(org.testng.internal.IConfiguration configuration, XmlSuite suite, String outputDir, ITestRunnerFactory runnerFactory, boolean useDefaultListeners, List<IMethodInterceptor> methodInterceptors, Collection<IInvokedMethodListener> invokedMethodListener, org.testng.SuiteRunner.TestListenersContainer container, Collection<IClassListener> classListeners, DataProviderHolder holder, Comparator<ITestNGMethod> comparator) SuiteRunner
(org.testng.internal.IConfiguration configuration, XmlSuite suite, String outputDir, ITestRunnerFactory runnerFactory, Comparator<ITestNGMethod> comparator) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addListener
(ISuiteListener reporter) void
addListener
(ITestNGListener listener) void
afterInvocation
(IInvokedMethod method, ITestResult testResult) void
beforeInvocation
(IInvokedMethod method, ITestResult testResult) org.testng.internal.annotations.IAnnotationFinder
Returns the annotation finder for the given annotation type.getAttribute
(String name) getHost()
Retrieves the map of groups and their associated test methods.getName()
getParameter
(String parameterName) FIXME: should be removed?com.google.inject.Injector
Retrieves the shared state for a suite.removeAttribute
(String name) Remove the attributevoid
run()
Triggers the start of running tests included in the suite.void
setAttribute
(String name, Object value) Set a custom attribute.void
void
setObjectFactory
(ITestObjectFactory objectFactory) void
setParentInjector
(com.google.inject.Injector injector) void
setReportResults
(boolean reportResults) void
setSkipFailedInvocationCounts
(Boolean skipFailedInvocationCounts)
-
Constructor Details
-
SuiteRunner
public SuiteRunner(org.testng.internal.IConfiguration configuration, XmlSuite suite, String outputDir, ITestRunnerFactory runnerFactory, Comparator<ITestNGMethod> comparator) -
SuiteRunner
public SuiteRunner(org.testng.internal.IConfiguration configuration, XmlSuite suite, String outputDir, ITestRunnerFactory runnerFactory, boolean useDefaultListeners, Comparator<ITestNGMethod> comparator) -
SuiteRunner
protected SuiteRunner(org.testng.internal.IConfiguration configuration, XmlSuite suite, String outputDir, ITestRunnerFactory runnerFactory, boolean useDefaultListeners, List<IMethodInterceptor> methodInterceptors, Collection<IInvokedMethodListener> invokedMethodListener, org.testng.SuiteRunner.TestListenersContainer container, Collection<IClassListener> classListeners, DataProviderHolder holder, Comparator<ITestNGMethod> comparator)
-
-
Method Details
-
getXmlSuite
- Specified by:
getXmlSuite
in interfaceISuite
- Returns:
- The representation of the current XML suite file.
-
getName
-
setObjectFactory
-
setReportResults
public void setReportResults(boolean reportResults) -
getExitCodeListener
- Specified by:
getExitCodeListener
in interfaceISuiteRunnerListener
-
getParallel
- Specified by:
getParallel
in interfaceISuite
- Returns:
- true if the tests must be run in parallel.
-
getParentModule
- Specified by:
getParentModule
in interfaceISuite
-
getGuiceStage
- Specified by:
getGuiceStage
in interfaceISuite
-
getParentInjector
public com.google.inject.Injector getParentInjector()- Specified by:
getParentInjector
in interfaceISuite
-
setParentInjector
public void setParentInjector(com.google.inject.Injector injector) - Specified by:
setParentInjector
in interfaceISuite
-
run
public void run()Description copied from interface:ISuite
Triggers the start of running tests included in the suite. -
getReporters
-
getDataProviderListeners
-
addListener
- Parameters:
reporter
- The ISuiteListener interested in reporting the result of the current suite.
-
addListener
- Specified by:
addListener
in interfaceISuite
-
getOutputDirectory
- Specified by:
getOutputDirectory
in interfaceISuite
- Returns:
- The output directory used for the reports.
-
getResults
- Specified by:
getResults
in interfaceISuite
- Returns:
- The results for this suite.
-
getParameter
FIXME: should be removed?- Specified by:
getParameter
in interfaceISuite
- Parameters:
parameterName
- The name of the parameter- Returns:
- The value of this parameter, or null if none was specified.
- See Also:
-
getMethodsByGroups
Description copied from interface:ISuite
Retrieves the map of groups and their associated test methods.- Specified by:
getMethodsByGroups
in interfaceISuite
- Returns:
- A map where the key is the group and the value is a list of methods used by this group.
- See Also:
-
getExcludedMethods
- Specified by:
getExcludedMethods
in interfaceISuite
- Returns:
- All the methods that were not included in this test run.
- See Also:
-
getObjectFactory
- Specified by:
getObjectFactory
in interfaceISuite
- Returns:
- The object factory used to create all test instances.
-
getAnnotationFinder
public org.testng.internal.annotations.IAnnotationFinder getAnnotationFinder()Returns the annotation finder for the given annotation type.- Specified by:
getAnnotationFinder
in interfaceISuite
- Returns:
- the annotation finder for the given annotation type.
-
setHost
-
getHost
-
getSuiteState
Description copied from interface:ISuite
Retrieves the shared state for a suite.- Specified by:
getSuiteState
in interfaceISuite
- Returns:
- the share state of the current suite.
- See Also:
-
setSkipFailedInvocationCounts
-
getAttribute
- Specified by:
getAttribute
in interfaceIAttributes
- Parameters:
name
- The name of the attribute to return- Returns:
- The attribute
-
setAttribute
Description copied from interface:IAttributes
Set a custom attribute.- Specified by:
setAttribute
in interfaceIAttributes
- Parameters:
name
- The attribute namevalue
- The attribute value
-
getAttributeNames
- Specified by:
getAttributeNames
in interfaceIAttributes
- Returns:
- all the attributes names.
-
removeAttribute
Description copied from interface:IAttributes
Remove the attribute- Specified by:
removeAttribute
in interfaceIAttributes
- Parameters:
name
- The attribute name- Returns:
- the attribute value if found, null otherwise
-
afterInvocation
- Specified by:
afterInvocation
in interfaceISuiteRunnerListener
-
beforeInvocation
- Specified by:
beforeInvocation
in interfaceISuiteRunnerListener
-
getAllInvokedMethods
- Specified by:
getAllInvokedMethods
in interfaceISuite
- Returns:
- a list of all the methods that were invoked in this suite.
-
getAllMethods
- Specified by:
getAllMethods
in interfaceISuite
- Returns:
- the total number of methods found in this suite. The presence of factories or data providers might cause the actual number of test methods run be bigger than this list.
-