org.testng
Class SuiteRunner

java.lang.Object
  extended by org.testng.SuiteRunner
All Implemented Interfaces:
java.io.Serializable, IAttributes, ISuite

public class SuiteRunner
extends java.lang.Object
implements ISuite, java.io.Serializable

SuiteRunner is responsible for running all the tests included in one suite. The test start is triggered by run() method.

Author:
Cedric Beust, Apr 26, 2004
See Also:
Serialized Form

Nested Class Summary
static class SuiteRunner.DefaultTestRunnerFactory
          The default implementation of ITestRunnerFactory.
static class SuiteRunner.ProxyTestRunnerFactory
           
 
Constructor Summary
SuiteRunner(XmlSuite suite, java.lang.String outputDir, IAnnotationFinder[] finders)
           
SuiteRunner(XmlSuite suite, java.lang.String outputDir, ITestRunnerFactory runnerFactory, boolean useDefaultListeners, IAnnotationFinder[] finders)
           
SuiteRunner(XmlSuite suite, java.lang.String outputDir, ITestRunnerFactory runnerFactory, boolean useDefaultListeners, IAnnotationFinder[] finders, IObjectFactory factory, IMethodInterceptor methodInterceptor, java.util.List<IInvokedMethodListener> invokedMethodListener)
           
SuiteRunner(XmlSuite suite, java.lang.String outputDir, ITestRunnerFactory runnerFactory, IAnnotationFinder[] finders)
           
 
Method Summary
 void addListener(ISuiteListener reporter)
          Registers ISuiteListeners interested in reporting the result of the current suite.
protected  ITestRunnerFactory buildRunnerFactory(java.util.List testListeners)
           
 IAnnotationFinder getAnnotationFinder(java.lang.String pAnnotationType)
          Returns the annotation finder for the given annotation type.
 java.lang.Object getAttribute(java.lang.String name)
           
 java.util.Collection<ITestNGMethod> getExcludedMethods()
           
 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()
           
 java.lang.String getOutputDirectory()
           
 java.lang.String getParallel()
           
 java.lang.String getParameter(java.lang.String parameterName)
          FIXME: should be removed?
 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)
           
 void 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(IObjectFactory objectFactory)
           
 void setReportResults(boolean reportResults)
           
 void setSkipFailedInvocationCounts(java.lang.Boolean skipFailedInvocationCounts)
           
 void setTestListeners(java.util.List<ITestListener> testlisteners)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SuiteRunner

public SuiteRunner(XmlSuite suite,
                   java.lang.String outputDir,
                   IAnnotationFinder[] finders)

SuiteRunner

public SuiteRunner(XmlSuite suite,
                   java.lang.String outputDir,
                   ITestRunnerFactory runnerFactory,
                   IAnnotationFinder[] finders)

SuiteRunner

public SuiteRunner(XmlSuite suite,
                   java.lang.String outputDir,
                   ITestRunnerFactory runnerFactory,
                   boolean useDefaultListeners,
                   IAnnotationFinder[] finders)

SuiteRunner

public SuiteRunner(XmlSuite suite,
                   java.lang.String outputDir,
                   ITestRunnerFactory runnerFactory,
                   boolean useDefaultListeners,
                   IAnnotationFinder[] finders,
                   IObjectFactory factory,
                   IMethodInterceptor methodInterceptor,
                   java.util.List<IInvokedMethodListener> invokedMethodListener)
Method Detail

getXmlSuite

public XmlSuite getXmlSuite()
Specified by:
getXmlSuite in interface ISuite
Returns:
The representation of the current XML suite file.

getName

public java.lang.String getName()
Specified by:
getName in interface ISuite
Returns:
the name of this suite.

setObjectFactory

public void setObjectFactory(IObjectFactory objectFactory)

setTestListeners

public void setTestListeners(java.util.List<ITestListener> testlisteners)

setReportResults

public void setReportResults(boolean reportResults)

buildRunnerFactory

protected ITestRunnerFactory buildRunnerFactory(java.util.List testListeners)

getParallel

public java.lang.String getParallel()
Specified by:
getParallel in interface ISuite
Returns:
true if the tests must be run in parallel.

run

public void run()
Description copied from interface: ISuite
Triggers the start of running tests included in the suite.

Specified by:
run in interface ISuite

addListener

public void addListener(ISuiteListener reporter)
Registers ISuiteListeners interested in reporting the result of the current suite.

Parameters:
reporter -

getOutputDirectory

public java.lang.String getOutputDirectory()
Specified by:
getOutputDirectory in interface ISuite
Returns:
The output directory used for the reports.

getResults

public java.util.Map<java.lang.String,ISuiteResult> getResults()
Specified by:
getResults in interface ISuite
Returns:
The results for this suite.

getParameter

public java.lang.String getParameter(java.lang.String parameterName)
FIXME: should be removed?

Specified by:
getParameter in interface ISuite
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 interface ISuite
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 interface ISuite
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 interface ISuite
Returns:
All the methods that were not included in this test run.
See Also:
ISuite.getExcludedMethods()

getObjectFactory

public IObjectFactory getObjectFactory()
Specified by:
getObjectFactory in interface ISuite
Returns:
The object factory used to create all test instances.

getAnnotationFinder

public IAnnotationFinder getAnnotationFinder(java.lang.String pAnnotationType)
Returns the annotation finder for the given annotation type.

Specified by:
getAnnotationFinder in interface ISuite
Parameters:
pAnnotationType - the annotation type
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()
Specified by:
getHost in interface ISuite
Returns:
The host where this suite was run, or null if it was run locally. The returned string has the form: host:port

getSuiteState

public SuiteRunState getSuiteState()
Description copied from interface: ISuite
Retrieves the shared state for a suite.

Specified by:
getSuiteState in interface ISuite
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 interface IAttributes
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 interface IAttributes