Package org.testng
Class SuiteRunner
- java.lang.Object
-
- org.testng.SuiteRunner
-
- All Implemented Interfaces:
IAttributes
,IInvokedMethodListener
,ISuite
,ITestNGListener
public class SuiteRunner extends java.lang.Object implements ISuite, IInvokedMethodListener
SuiteRunner
is responsible for running all the tests included in one suite. The test start is triggered byrun()
method.
-
-
Constructor Summary
Constructors Modifier Constructor Description SuiteRunner(IConfiguration configuration, XmlSuite suite, java.lang.String outputDir)
Deprecated.SuiteRunner(IConfiguration configuration, XmlSuite suite, java.lang.String outputDir, java.util.Comparator<ITestNGMethod> comparator)
SuiteRunner(IConfiguration configuration, XmlSuite suite, java.lang.String outputDir, ITestRunnerFactory runnerFactory)
Deprecated.SuiteRunner(IConfiguration configuration, XmlSuite suite, java.lang.String outputDir, ITestRunnerFactory runnerFactory, boolean useDefaultListeners)
Deprecated.SuiteRunner(IConfiguration configuration, XmlSuite suite, java.lang.String outputDir, ITestRunnerFactory runnerFactory, boolean useDefaultListeners, java.util.Comparator<ITestNGMethod> comparator)
protected
SuiteRunner(IConfiguration configuration, XmlSuite suite, java.lang.String outputDir, ITestRunnerFactory runnerFactory, boolean useDefaultListeners, java.util.List<IMethodInterceptor> methodInterceptors, java.util.Collection<IInvokedMethodListener> invokedMethodListeners, java.util.Collection<ITestListener> testListeners, java.util.Collection<IClassListener> classListeners)
Deprecated.protected
SuiteRunner(IConfiguration configuration, XmlSuite suite, java.lang.String outputDir, ITestRunnerFactory runnerFactory, boolean useDefaultListeners, java.util.List<IMethodInterceptor> methodInterceptors, java.util.Collection<IInvokedMethodListener> invokedMethodListeners, java.util.Collection<ITestListener> testListeners, java.util.Collection<IClassListener> classListeners, java.util.Comparator<ITestNGMethod> comparator)
Deprecated.- This constructor stands deprecated as of TestNG v6.13.protected
SuiteRunner(IConfiguration configuration, XmlSuite suite, java.lang.String outputDir, ITestRunnerFactory runnerFactory, boolean useDefaultListeners, java.util.List<IMethodInterceptor> methodInterceptors, java.util.Collection<IInvokedMethodListener> invokedMethodListeners, java.util.Collection<ITestListener> testListeners, java.util.Collection<IClassListener> classListeners, java.util.Map<java.lang.Class<? extends IDataProviderListener>,IDataProviderListener> dataProviderListeners, java.util.Comparator<ITestNGMethod> comparator)
protected
SuiteRunner(IConfiguration configuration, XmlSuite suite, java.lang.String outputDir, ITestRunnerFactory runnerFactory, boolean useDefaultListeners, java.util.List<IMethodInterceptor> methodInterceptors, java.util.List<IInvokedMethodListener> invokedMethodListeners, java.util.List<ITestListener> testListeners, java.util.List<IClassListener> classListeners)
Deprecated.- This constructor stands deprecated.SuiteRunner(IConfiguration configuration, XmlSuite suite, java.lang.String outputDir, ITestRunnerFactory runnerFactory, java.util.Comparator<ITestNGMethod> comparator)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addListener(ISuiteListener reporter)
Registers ISuiteListeners interested in reporting the result of the current suite.void
addListener(ITestNGListener listener)
void
afterInvocation(IInvokedMethod method, ITestResult testResult)
void
beforeInvocation(IInvokedMethod method, ITestResult testResult)
java.util.List<IInvokedMethod>
getAllInvokedMethods()
java.util.List<ITestNGMethod>
getAllMethods()
IAnnotationFinder
getAnnotationFinder()
Returns the annotation finder for the given annotation type.java.lang.Object
getAttribute(java.lang.String name)
java.util.Set<java.lang.String>
getAttributeNames()
java.util.Collection<ITestNGMethod>
getExcludedMethods()
java.lang.String
getGuiceStage()
java.lang.String
getHost()
java.util.Collection<ITestNGMethod>
getInvokedMethods()
Retrieves the list of all the methods that were invoked during this run.java.util.Map<java.lang.String,java.util.Collection<ITestNGMethod>>
getMethodsByGroups()
Retrieves the map of groups and their associated test methods.java.lang.String
getName()
IObjectFactory
getObjectFactory()
IObjectFactory2
getObjectFactory2()
java.lang.String
getOutputDirectory()
java.lang.String
getParallel()
java.lang.String
getParameter(java.lang.String parameterName)
FIXME: should be removed?com.google.inject.Injector
getParentInjector()
java.lang.String
getParentModule()
java.util.List<IReporter>
getReporters()
java.util.Map<java.lang.String,ISuiteResult>
getResults()
SuiteRunState
getSuiteState()
Retrieves the shared state for a suite.XmlSuite
getXmlSuite()
static void
ppp(java.lang.String s)
java.lang.Object
removeAttribute(java.lang.String name)
Remove the attributevoid
run()
Triggers the start of running tests included in the suite.void
setAttribute(java.lang.String name, java.lang.Object value)
Set a custom attribute.void
setHost(java.lang.String host)
void
setObjectFactory(ITestObjectFactory objectFactory)
void
setParentInjector(com.google.inject.Injector injector)
void
setReportResults(boolean reportResults)
void
setSkipFailedInvocationCounts(java.lang.Boolean skipFailedInvocationCounts)
-
-
-
Constructor Detail
-
SuiteRunner
public SuiteRunner(IConfiguration configuration, XmlSuite suite, java.lang.String outputDir, java.util.Comparator<ITestNGMethod> comparator)
-
SuiteRunner
public SuiteRunner(IConfiguration configuration, XmlSuite suite, java.lang.String outputDir, ITestRunnerFactory runnerFactory, java.util.Comparator<ITestNGMethod> comparator)
-
SuiteRunner
public SuiteRunner(IConfiguration configuration, XmlSuite suite, java.lang.String outputDir, ITestRunnerFactory runnerFactory, boolean useDefaultListeners, java.util.Comparator<ITestNGMethod> comparator)
-
SuiteRunner
@Deprecated public SuiteRunner(IConfiguration configuration, XmlSuite suite, java.lang.String outputDir)
Deprecated.
-
SuiteRunner
@Deprecated public SuiteRunner(IConfiguration configuration, XmlSuite suite, java.lang.String outputDir, ITestRunnerFactory runnerFactory)
Deprecated.
-
SuiteRunner
@Deprecated public SuiteRunner(IConfiguration configuration, XmlSuite suite, java.lang.String outputDir, ITestRunnerFactory runnerFactory, boolean useDefaultListeners)
Deprecated.
-
SuiteRunner
@Deprecated protected SuiteRunner(IConfiguration configuration, XmlSuite suite, java.lang.String outputDir, ITestRunnerFactory runnerFactory, boolean useDefaultListeners, java.util.List<IMethodInterceptor> methodInterceptors, java.util.List<IInvokedMethodListener> invokedMethodListeners, java.util.List<ITestListener> testListeners, java.util.List<IClassListener> classListeners)
Deprecated.- This constructor stands deprecated.
-
SuiteRunner
@Deprecated protected SuiteRunner(IConfiguration configuration, XmlSuite suite, java.lang.String outputDir, ITestRunnerFactory runnerFactory, boolean useDefaultListeners, java.util.List<IMethodInterceptor> methodInterceptors, java.util.Collection<IInvokedMethodListener> invokedMethodListeners, java.util.Collection<ITestListener> testListeners, java.util.Collection<IClassListener> classListeners)
Deprecated.
-
SuiteRunner
@Deprecated protected SuiteRunner(IConfiguration configuration, XmlSuite suite, java.lang.String outputDir, ITestRunnerFactory runnerFactory, boolean useDefaultListeners, java.util.List<IMethodInterceptor> methodInterceptors, java.util.Collection<IInvokedMethodListener> invokedMethodListeners, java.util.Collection<ITestListener> testListeners, java.util.Collection<IClassListener> classListeners, java.util.Comparator<ITestNGMethod> comparator)
Deprecated.- This constructor stands deprecated as of TestNG v6.13.
-
SuiteRunner
protected SuiteRunner(IConfiguration configuration, XmlSuite suite, java.lang.String outputDir, ITestRunnerFactory runnerFactory, boolean useDefaultListeners, java.util.List<IMethodInterceptor> methodInterceptors, java.util.Collection<IInvokedMethodListener> invokedMethodListeners, java.util.Collection<ITestListener> testListeners, java.util.Collection<IClassListener> classListeners, java.util.Map<java.lang.Class<? extends IDataProviderListener>,IDataProviderListener> dataProviderListeners, java.util.Comparator<ITestNGMethod> comparator)
-
-
Method Detail
-
getXmlSuite
public XmlSuite getXmlSuite()
- Specified by:
getXmlSuite
in interfaceISuite
- Returns:
- The representation of the current XML suite file.
-
getName
public java.lang.String getName()
-
setObjectFactory
public void setObjectFactory(ITestObjectFactory objectFactory)
-
setReportResults
public void setReportResults(boolean reportResults)
-
getParallel
public java.lang.String getParallel()
- Specified by:
getParallel
in interfaceISuite
- Returns:
- true if the tests must be run in parallel.
-
getParentModule
public java.lang.String getParentModule()
- Specified by:
getParentModule
in interfaceISuite
-
getGuiceStage
public java.lang.String 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
public java.util.List<IReporter> getReporters()
-
addListener
protected void addListener(ISuiteListener reporter)
Registers ISuiteListeners interested in reporting the result of the current suite.- Parameters:
reporter
-
-
addListener
public void addListener(ITestNGListener listener)
- Specified by:
addListener
in interfaceISuite
-
getOutputDirectory
public java.lang.String getOutputDirectory()
- Specified by:
getOutputDirectory
in interfaceISuite
- Returns:
- The output directory used for the reports.
-
getResults
public java.util.Map<java.lang.String,ISuiteResult> getResults()
- Specified by:
getResults
in interfaceISuite
- Returns:
- The results for this suite.
-
getParameter
public java.lang.String getParameter(java.lang.String parameterName)
FIXME: should be removed?- Specified by:
getParameter
in interfaceISuite
- Returns:
- The value of this parameter, or null if none was specified.
- See Also:
ISuite.getParameter(java.lang.String)
-
getMethodsByGroups
public java.util.Map<java.lang.String,java.util.Collection<ITestNGMethod>> 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:
ISuite.getMethodsByGroups()
-
getInvokedMethods
public java.util.Collection<ITestNGMethod> getInvokedMethods()
Description copied from interface:ISuite
Retrieves the list of all the methods that were invoked during this run.- Specified by:
getInvokedMethods
in interfaceISuite
- Returns:
- a collection of ITestNGMethods belonging to all tests included in the suite.
- See Also:
ISuite.getInvokedMethods()
-
getExcludedMethods
public java.util.Collection<ITestNGMethod> getExcludedMethods()
- Specified by:
getExcludedMethods
in interfaceISuite
- Returns:
- All the methods that were not included in this test run.
- See Also:
ISuite.getExcludedMethods()
-
getObjectFactory
public IObjectFactory getObjectFactory()
- Specified by:
getObjectFactory
in interfaceISuite
- Returns:
- The object factory used to create all test instances.
-
getObjectFactory2
public IObjectFactory2 getObjectFactory2()
- Specified by:
getObjectFactory2
in interfaceISuite
-
getAnnotationFinder
public 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.
-
ppp
public static void ppp(java.lang.String s)
-
setHost
public void setHost(java.lang.String host)
-
getHost
public java.lang.String getHost()
-
getSuiteState
public SuiteRunState 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:
ISuite.getSuiteState()
-
setSkipFailedInvocationCounts
public void setSkipFailedInvocationCounts(java.lang.Boolean skipFailedInvocationCounts)
-
getAttribute
public java.lang.Object getAttribute(java.lang.String name)
- Specified by:
getAttribute
in interfaceIAttributes
- Parameters:
name
- The name of the attribute to return
-
setAttribute
public void setAttribute(java.lang.String name, java.lang.Object value)
Description copied from interface:IAttributes
Set a custom attribute.- Specified by:
setAttribute
in interfaceIAttributes
-
getAttributeNames
public java.util.Set<java.lang.String> getAttributeNames()
- Specified by:
getAttributeNames
in interfaceIAttributes
- Returns:
- all the attributes names.
-
removeAttribute
public java.lang.Object removeAttribute(java.lang.String name)
Description copied from interface:IAttributes
Remove the attribute- Specified by:
removeAttribute
in interfaceIAttributes
- Returns:
- the attribute value if found, null otherwise
-
afterInvocation
public void afterInvocation(IInvokedMethod method, ITestResult testResult)
- Specified by:
afterInvocation
in interfaceIInvokedMethodListener
-
beforeInvocation
public void beforeInvocation(IInvokedMethod method, ITestResult testResult)
- Specified by:
beforeInvocation
in interfaceIInvokedMethodListener
-
getAllInvokedMethods
public java.util.List<IInvokedMethod> getAllInvokedMethods()
- Specified by:
getAllInvokedMethods
in interfaceISuite
- Returns:
- a list of all the methods that were invoked in this suite.
-
getAllMethods
public java.util.List<ITestNGMethod> 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.
-
-