public class SuiteRunner extends java.lang.Object implements ISuite, java.io.Serializable, IInvokedMethodListener
SuiteRunner
is responsible for running all the tests included in one
suite. The test start is triggered by run()
method.Modifier and Type | Class and Description |
---|---|
private static class |
SuiteRunner.DefaultTestRunnerFactory
The default implementation of
ITestRunnerFactory . |
private static class |
SuiteRunner.ProxyTestRunnerFactory |
private class |
SuiteRunner.SuiteWorker |
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
DEFAULT_OUTPUT_DIR |
private java.util.List<ITestNGMethod> |
m_allTestMethods |
private IAttributes |
m_attributes |
private java.util.List<IClassListener> |
m_classListeners |
private IConfiguration |
m_configuration |
private java.lang.String |
m_host |
private java.util.Map<java.lang.Class<? extends IInvokedMethodListener>,IInvokedMethodListener> |
m_invokedMethodListeners |
private java.util.List<IInvokedMethod> |
m_invokedMethods
The list of all the methods invoked during this run
|
private java.util.Map<java.lang.Class<? extends ISuiteListener>,ISuiteListener> |
m_listeners |
private java.util.List<IMethodInterceptor> |
m_methodInterceptors |
private ITestObjectFactory |
m_objectFactory |
private java.lang.String |
m_outputDir |
private com.google.inject.Injector |
m_parentInjector |
private java.util.List<IReporter> |
m_reporters |
private ITestRunnerFactory |
m_runnerFactory |
private java.lang.Boolean |
m_skipFailedInvocationCounts |
private XmlSuite |
m_suite |
private java.util.Map<java.lang.String,ISuiteResult> |
m_suiteResults |
private SuiteRunState |
m_suiteState |
private java.util.List<ITestListener> |
m_testListeners |
private java.util.List<TestRunner> |
m_testRunners |
private TestListenerAdapter |
m_textReporter |
private ITestRunnerFactory |
m_tmpRunnerFactory |
private boolean |
m_useDefaultListeners |
private static long |
serialVersionUID |
Modifier | Constructor and Description |
---|---|
|
SuiteRunner(IConfiguration configuration,
XmlSuite suite,
java.lang.String outputDir) |
|
SuiteRunner(IConfiguration configuration,
XmlSuite suite,
java.lang.String outputDir,
ITestRunnerFactory runnerFactory) |
|
SuiteRunner(IConfiguration configuration,
XmlSuite suite,
java.lang.String outputDir,
ITestRunnerFactory runnerFactory,
boolean useDefaultListeners) |
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) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
addConfigurationListener(IConfigurationListener listener) |
protected void |
addListener(ISuiteListener reporter)
Registers ISuiteListeners interested in reporting the result of the current
suite.
|
void |
addListener(ITestNGListener listener) |
private void |
addReporter(IReporter listener) |
void |
afterInvocation(IInvokedMethod method,
ITestResult testResult) |
void |
beforeInvocation(IInvokedMethod method,
ITestResult testResult) |
private ITestRunnerFactory |
buildRunnerFactory() |
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() |
private java.util.Collection<ITestNGMethod> |
getIncludedOrExcludedMethods(boolean included) |
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() |
private void |
init(IConfiguration configuration,
XmlSuite suite,
java.lang.String outputDir,
ITestRunnerFactory runnerFactory,
boolean useDefaultListeners,
java.util.List<IMethodInterceptor> methodInterceptors,
java.util.List<IInvokedMethodListener> invokedMethodListener,
java.util.List<ITestListener> testListeners,
java.util.List<IClassListener> classListeners) |
private void |
invokeListeners(boolean start) |
static void |
ppp(java.lang.String s) |
private void |
privateRun() |
java.lang.Object |
removeAttribute(java.lang.String name)
Remove the attribute
|
void |
run()
Triggers the start of running tests included in the suite.
|
private void |
runInParallelTestMode()
Implement
|
private void |
runSequentially() |
private void |
runTest(TestRunner tr) |
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Set a custom attribute.
|
void |
setHost(java.lang.String host) |
void |
setObjectFactory(ITestObjectFactory objectFactory) |
private void |
setOutputDir(java.lang.String outputdir) |
void |
setParentInjector(com.google.inject.Injector injector) |
void |
setReportResults(boolean reportResults) |
void |
setSkipFailedInvocationCounts(java.lang.Boolean skipFailedInvocationCounts) |
private static final long serialVersionUID
private static final java.lang.String DEFAULT_OUTPUT_DIR
private java.util.Map<java.lang.String,ISuiteResult> m_suiteResults
private transient java.util.List<TestRunner> m_testRunners
private transient java.util.Map<java.lang.Class<? extends ISuiteListener>,ISuiteListener> m_listeners
private transient TestListenerAdapter m_textReporter
private java.lang.String m_outputDir
private XmlSuite m_suite
private com.google.inject.Injector m_parentInjector
private transient java.util.List<ITestListener> m_testListeners
private transient java.util.List<IClassListener> m_classListeners
private transient ITestRunnerFactory m_tmpRunnerFactory
private transient ITestRunnerFactory m_runnerFactory
private transient boolean m_useDefaultListeners
private java.lang.String m_host
private transient IConfiguration m_configuration
private transient ITestObjectFactory m_objectFactory
private transient java.lang.Boolean m_skipFailedInvocationCounts
private transient java.util.List<IMethodInterceptor> m_methodInterceptors
private java.util.Map<java.lang.Class<? extends IInvokedMethodListener>,IInvokedMethodListener> m_invokedMethodListeners
private java.util.List<IInvokedMethod> m_invokedMethods
private java.util.List<ITestNGMethod> m_allTestMethods
private java.util.List<IReporter> m_reporters
private SuiteRunState m_suiteState
private IAttributes m_attributes
public SuiteRunner(IConfiguration configuration, XmlSuite suite, java.lang.String outputDir)
public SuiteRunner(IConfiguration configuration, XmlSuite suite, java.lang.String outputDir, ITestRunnerFactory runnerFactory)
public SuiteRunner(IConfiguration configuration, XmlSuite suite, java.lang.String outputDir, ITestRunnerFactory runnerFactory, boolean useDefaultListeners)
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)
private void init(IConfiguration configuration, XmlSuite suite, java.lang.String outputDir, ITestRunnerFactory runnerFactory, boolean useDefaultListeners, java.util.List<IMethodInterceptor> methodInterceptors, java.util.List<IInvokedMethodListener> invokedMethodListener, java.util.List<ITestListener> testListeners, java.util.List<IClassListener> classListeners)
public XmlSuite getXmlSuite()
getXmlSuite
in interface ISuite
public java.lang.String getName()
public void setObjectFactory(ITestObjectFactory objectFactory)
public void setReportResults(boolean reportResults)
private void invokeListeners(boolean start)
private void setOutputDir(java.lang.String outputdir)
private ITestRunnerFactory buildRunnerFactory()
public java.lang.String getParallel()
getParallel
in interface ISuite
public java.lang.String getParentModule()
getParentModule
in interface ISuite
public java.lang.String getGuiceStage()
getGuiceStage
in interface ISuite
public com.google.inject.Injector getParentInjector()
getParentInjector
in interface ISuite
public void setParentInjector(com.google.inject.Injector injector)
setParentInjector
in interface ISuite
public void run()
ISuite
private void privateRun()
private void addReporter(IReporter listener)
void addConfigurationListener(IConfigurationListener listener)
public java.util.List<IReporter> getReporters()
private void runSequentially()
private void runTest(TestRunner tr)
private void runInParallelTestMode()
protected void addListener(ISuiteListener reporter)
reporter
- public void addListener(ITestNGListener listener)
addListener
in interface ISuite
public java.lang.String getOutputDirectory()
getOutputDirectory
in interface ISuite
public java.util.Map<java.lang.String,ISuiteResult> getResults()
getResults
in interface ISuite
public java.lang.String getParameter(java.lang.String parameterName)
getParameter
in interface ISuite
ISuite.getParameter(java.lang.String)
public java.util.Map<java.lang.String,java.util.Collection<ITestNGMethod>> getMethodsByGroups()
ISuite
getMethodsByGroups
in interface ISuite
ISuite.getMethodsByGroups()
public java.util.Collection<ITestNGMethod> getInvokedMethods()
ISuite
getInvokedMethods
in interface ISuite
ISuite.getInvokedMethods()
public java.util.Collection<ITestNGMethod> getExcludedMethods()
getExcludedMethods
in interface ISuite
ISuite.getExcludedMethods()
private java.util.Collection<ITestNGMethod> getIncludedOrExcludedMethods(boolean included)
public IObjectFactory getObjectFactory()
getObjectFactory
in interface ISuite
public IObjectFactory2 getObjectFactory2()
getObjectFactory2
in interface ISuite
public IAnnotationFinder getAnnotationFinder()
getAnnotationFinder
in interface ISuite
public static void ppp(java.lang.String s)
public void setHost(java.lang.String host)
public java.lang.String getHost()
public SuiteRunState getSuiteState()
ISuite
getSuiteState
in interface ISuite
ISuite.getSuiteState()
public void setSkipFailedInvocationCounts(java.lang.Boolean skipFailedInvocationCounts)
public java.lang.Object getAttribute(java.lang.String name)
getAttribute
in interface IAttributes
name
- The name of the attribute to returnpublic void setAttribute(java.lang.String name, java.lang.Object value)
IAttributes
setAttribute
in interface IAttributes
public java.util.Set<java.lang.String> getAttributeNames()
getAttributeNames
in interface IAttributes
public java.lang.Object removeAttribute(java.lang.String name)
IAttributes
removeAttribute
in interface IAttributes
public void afterInvocation(IInvokedMethod method, ITestResult testResult)
afterInvocation
in interface IInvokedMethodListener
public void beforeInvocation(IInvokedMethod method, ITestResult testResult)
beforeInvocation
in interface IInvokedMethodListener
public java.util.List<IInvokedMethod> getAllInvokedMethods()
getAllInvokedMethods
in interface ISuite
public java.util.List<ITestNGMethod> getAllMethods()
getAllMethods
in interface ISuite