Package org.testng.xml
Class XmlSuite
- java.lang.Object
-
- org.testng.xml.XmlSuite
-
- All Implemented Interfaces:
java.lang.Cloneable
public class XmlSuite extends java.lang.Object implements java.lang.Cloneable
This class describes the tag <suite> in testng.xml.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
XmlSuite.FailurePolicy
Configuration failure policy optionsstatic class
XmlSuite.ParallelMode
Parallel modes
-
Field Summary
Fields Modifier and Type Field Description static java.lang.Boolean
DEFAULT_ALLOW_RETURN_VALUES
static XmlSuite.FailurePolicy
DEFAULT_CONFIG_FAILURE_POLICY
Whether to SKIP or CONTINUE to re-attempt failed configuration methods.static java.lang.Integer
DEFAULT_DATA_PROVIDER_THREAD_COUNT
Thread count for the data provider poolstatic java.lang.Boolean
DEFAULT_GROUP_BY_INSTANCES
By default, a method failing will cause all instances of that class to skipstatic java.lang.Boolean
DEFAULT_JUNIT
JUnit compatibility flag.static java.lang.Boolean
DEFAULT_MIXED
mixed mode flag.static XmlSuite.ParallelMode
DEFAULT_PARALLEL
static java.lang.Boolean
DEFAULT_PRESERVE_ORDER
static java.lang.Boolean
DEFAULT_SKIP_FAILED_INVOCATION_COUNTS
private static java.lang.String
DEFAULT_SUITE_NAME
The default suite name TODO CQ is this OK as a default name.static java.lang.Integer
DEFAULT_THREAD_COUNT
The thread count.static java.lang.Integer
DEFAULT_VERBOSE
The suite verbose flag.private java.lang.Boolean
m_allowReturnValues
private java.util.List<XmlSuite>
m_childSuites
List of child XML suite specified usingtags private XmlSuite.FailurePolicy
m_configFailurePolicy
private int
m_dataProviderThreadCount
private java.util.List<java.lang.String>
m_excludedGroups
private java.lang.String
m_expression
BeanShell expression.private java.lang.String
m_fileName
Name of the XML fileprivate java.lang.Boolean
m_groupByInstances
private java.lang.String
m_guiceStage
private java.util.List<java.lang.String>
m_includedGroups
private java.lang.Boolean
m_isJUnit
private java.util.List<java.lang.String>
m_listeners
private java.util.List<XmlMethodSelector>
m_methodSelectors
Suite level method selectors.private java.lang.String
m_name
The suite name (defaults to DEFAULT_SUITE_NAME)private ITestObjectFactory
m_objectFactory
private XmlSuite.ParallelMode
m_parallel
private java.util.Map<java.lang.String,java.lang.String>
m_parameters
Suite level parameters.private java.lang.String
m_parentModule
private XmlSuite
m_parentSuite
Parent XML Suite if this suite was specified in another suite usingtag private java.lang.Boolean
m_preserveOrder
private java.lang.Boolean
m_skipFailedInvocationCounts
private java.util.List<java.lang.String>
m_suiteFiles
private java.lang.String
m_test
private java.util.List<XmlTest>
m_tests
Tests in suite.private int
m_threadCount
private java.lang.String
m_timeOut
Time out for methods/testsprivate java.lang.Integer
m_verbose
private XmlGroups
m_xmlGroups
private XmlMethodSelectors
m_xmlMethodSelectors
private java.util.List<XmlPackage>
m_xmlPackages
The packages containing test classes.private boolean
parsed
-
Constructor Summary
Constructors Constructor Description XmlSuite()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addExcludedGroup(java.lang.String g)
void
addIncludedGroup(java.lang.String g)
void
addListener(java.lang.String listener)
void
addTest(XmlTest test)
java.lang.Object
clone()
Note that this is not a full clone: XmlTest children are not cloned by this method.boolean
equals(java.lang.Object obj)
(package private) static boolean
f()
Used to debug equals() bugs.java.lang.Boolean
getAllowReturnValues()
java.util.Map<java.lang.String,java.lang.String>
getAllParameters()
java.util.List<XmlSuite>
getChildSuites()
XmlSuite.FailurePolicy
getConfigFailurePolicy()
Returns the configuration failure policy.int
getDataProviderThreadCount()
java.util.List<java.lang.String>
getExcludedGroups()
java.lang.String
getFileName()
java.lang.Boolean
getGroupByInstances()
XmlGroups
getGroups()
java.lang.String
getGuiceStage()
java.util.List<java.lang.String>
getIncludedGroups()
java.util.List<java.lang.String>
getListeners()
java.util.List<java.lang.String>
getLocalListeners()
java.util.List<XmlMethodSelector>
getMethodSelectors()
Returns the method selectors.java.lang.String
getName()
Returns the name.ITestObjectFactory
getObjectFactory()
java.util.Collection<java.lang.String>
getPackageNames()
java.util.List<XmlPackage>
getPackages()
XmlSuite.ParallelMode
getParallel()
Returns the parallel mode.java.lang.String
getParameter(java.lang.String name)
Returns the parameter defined in this suite only.java.util.Map<java.lang.String,java.lang.String>
getParameters()
Gets the parameters that apply to tests in this suite.
Set of parameters for a suite is appended with parameters from parent suite.java.lang.String
getParentModule()
XmlSuite
getParentSuite()
java.lang.Boolean
getPreserveOrder()
java.util.List<java.lang.String>
getSuiteFiles()
Returns the suite files.java.lang.String
getTest()
Returns the test.java.util.List<XmlTest>
getTests()
Returns the tests.int
getThreadCount()
java.lang.String
getTimeOut()
Returns the timeout.long
getTimeOut(long def)
Returns the timeout as a long value specifying the default value to be used if no timeout was specified.java.lang.Integer
getVerbose()
Returns the verbose.XmlMethodSelectors
getXmlMethodSelectors()
java.util.List<XmlPackage>
getXmlPackages()
Returns the XML packages.int
hashCode()
java.lang.Boolean
isJUnit()
boolean
isParsed()
void
onListenerElement(java.lang.String className)
void
onMethodSelectorElement(java.lang.String language, java.lang.String name, java.lang.String priority)
void
onPackagesElement(java.lang.String name)
void
onParameterElement(java.lang.String name, java.lang.String value)
void
onSuiteFilesElement(java.lang.String path)
void
setAllowReturnValues(java.lang.Boolean allowReturnValues)
void
setConfigFailurePolicy(XmlSuite.FailurePolicy configFailurePolicy)
Sets the configuration failure policy.void
setDataProviderThreadCount(int count)
void
setExcludedGroups(java.util.List<java.lang.String> g)
void
setFileName(java.lang.String fileName)
void
setGroupByInstances(boolean f)
void
setGroups(XmlGroups xmlGroups)
void
setGuiceStage(java.lang.String guiceStage)
void
setIncludedGroups(java.util.List<java.lang.String> g)
void
setJunit(java.lang.Boolean j)
void
setJUnit(java.lang.Boolean isJUnit)
Sets the JUnit compatibility flag.void
setListeners(java.util.List<java.lang.String> listeners)
void
setMethodSelectors(java.util.List<XmlMethodSelector> methodSelectors)
Sets the method selectors.void
setMethodSelectors(XmlMethodSelectors xms)
void
setName(java.lang.String name)
Sets the name.void
setObjectFactory(ITestObjectFactory objectFactory)
void
setPackages(java.util.List<XmlPackage> packages)
void
setParallel(java.lang.String parallel)
Deprecated.Use #setParallel(XmlSuite.ParallelMode) insteadvoid
setParallel(XmlSuite.ParallelMode parallel)
Sets the parallel modevoid
setParameters(java.util.Map<java.lang.String,java.lang.String> parameters)
Sets parameters.void
setParentModule(java.lang.String parentModule)
void
setParentSuite(XmlSuite parentSuite)
void
setParsed(boolean parsed)
void
setPreserveOrder(java.lang.Boolean f)
void
setPreserveOrder(java.lang.String f)
Deprecated.UsesetPreserveOrder(Boolean)
insteadvoid
setSkipFailedInvocationCounts(boolean skip)
void
setSuiteFiles(java.util.List<java.lang.String> files)
Sets the suite files.void
setTests(java.util.List<XmlTest> tests)
void
setThreadCount(int threadCount)
Set the thread count.void
setTimeOut(java.lang.String timeOut)
Sets the timeout.void
setVerbose(java.lang.Integer verbose)
Set the verbose.void
setXmlMethodSelectors(XmlMethodSelectors xms)
void
setXmlPackages(java.util.List<XmlPackage> packages)
Sets the XML packages.XmlSuite
shallowCopy()
This method returns a shallow cloned version.java.lang.Boolean
skipFailedInvocationCounts()
java.lang.String
toString()
java.lang.String
toXml()
private void
updateParameters()
Updates the list of parameters that apply to this XML suite.
-
-
-
Field Detail
-
m_test
private java.lang.String m_test
-
DEFAULT_SUITE_NAME
private static final java.lang.String DEFAULT_SUITE_NAME
The default suite name TODO CQ is this OK as a default name.- See Also:
- Constant Field Values
-
m_name
private java.lang.String m_name
The suite name (defaults to DEFAULT_SUITE_NAME)
-
DEFAULT_VERBOSE
public static final java.lang.Integer DEFAULT_VERBOSE
The suite verbose flag. (0 to 10)
-
m_verbose
private java.lang.Integer m_verbose
-
DEFAULT_PARALLEL
public static final XmlSuite.ParallelMode DEFAULT_PARALLEL
-
m_parallel
private XmlSuite.ParallelMode m_parallel
-
m_parentModule
private java.lang.String m_parentModule
-
m_guiceStage
private java.lang.String m_guiceStage
-
DEFAULT_CONFIG_FAILURE_POLICY
public static final XmlSuite.FailurePolicy DEFAULT_CONFIG_FAILURE_POLICY
Whether to SKIP or CONTINUE to re-attempt failed configuration methods.
-
m_configFailurePolicy
private XmlSuite.FailurePolicy m_configFailurePolicy
-
DEFAULT_JUNIT
public static final java.lang.Boolean DEFAULT_JUNIT
JUnit compatibility flag.
-
m_isJUnit
private java.lang.Boolean m_isJUnit
-
DEFAULT_MIXED
public static final java.lang.Boolean DEFAULT_MIXED
mixed mode flag.
-
DEFAULT_SKIP_FAILED_INVOCATION_COUNTS
public static final java.lang.Boolean DEFAULT_SKIP_FAILED_INVOCATION_COUNTS
-
m_skipFailedInvocationCounts
private java.lang.Boolean m_skipFailedInvocationCounts
-
DEFAULT_THREAD_COUNT
public static final java.lang.Integer DEFAULT_THREAD_COUNT
The thread count.
-
m_threadCount
private int m_threadCount
-
DEFAULT_DATA_PROVIDER_THREAD_COUNT
public static final java.lang.Integer DEFAULT_DATA_PROVIDER_THREAD_COUNT
Thread count for the data provider pool
-
m_dataProviderThreadCount
private int m_dataProviderThreadCount
-
DEFAULT_GROUP_BY_INSTANCES
public static final java.lang.Boolean DEFAULT_GROUP_BY_INSTANCES
By default, a method failing will cause all instances of that class to skip
-
m_groupByInstances
private java.lang.Boolean m_groupByInstances
-
DEFAULT_ALLOW_RETURN_VALUES
public static final java.lang.Boolean DEFAULT_ALLOW_RETURN_VALUES
-
m_allowReturnValues
private java.lang.Boolean m_allowReturnValues
-
m_xmlPackages
private java.util.List<XmlPackage> m_xmlPackages
The packages containing test classes.
-
m_expression
private java.lang.String m_expression
BeanShell expression.
-
m_methodSelectors
private java.util.List<XmlMethodSelector> m_methodSelectors
Suite level method selectors.
-
m_tests
private java.util.List<XmlTest> m_tests
Tests in suite.
-
m_parameters
private java.util.Map<java.lang.String,java.lang.String> m_parameters
Suite level parameters.
-
m_fileName
private java.lang.String m_fileName
Name of the XML file
-
m_timeOut
private java.lang.String m_timeOut
Time out for methods/tests
-
m_childSuites
private java.util.List<XmlSuite> m_childSuites
List of child XML suite specified usingtags
-
m_parentSuite
private XmlSuite m_parentSuite
Parent XML Suite if this suite was specified in another suite usingtag
-
m_suiteFiles
private java.util.List<java.lang.String> m_suiteFiles
-
m_objectFactory
private ITestObjectFactory m_objectFactory
-
m_listeners
private java.util.List<java.lang.String> m_listeners
-
DEFAULT_PRESERVE_ORDER
public static final java.lang.Boolean DEFAULT_PRESERVE_ORDER
-
m_preserveOrder
private java.lang.Boolean m_preserveOrder
-
m_includedGroups
private java.util.List<java.lang.String> m_includedGroups
-
m_excludedGroups
private java.util.List<java.lang.String> m_excludedGroups
-
m_xmlMethodSelectors
private XmlMethodSelectors m_xmlMethodSelectors
-
parsed
private boolean parsed
-
m_xmlGroups
private XmlGroups m_xmlGroups
-
-
Method Detail
-
setParsed
public void setParsed(boolean parsed)
-
isParsed
public boolean isParsed()
- Returns:
- -
true
if the currentXmlSuite
has already been parsed.
-
getFileName
public java.lang.String getFileName()
- Returns:
- the fileName
-
setFileName
public void setFileName(java.lang.String fileName)
- Parameters:
fileName
- the fileName to set
-
getParallel
public XmlSuite.ParallelMode getParallel()
Returns the parallel mode.- Returns:
- the parallel mode.
-
getParentModule
public java.lang.String getParentModule()
-
getGuiceStage
public java.lang.String getGuiceStage()
-
getObjectFactory
public ITestObjectFactory getObjectFactory()
-
setObjectFactory
public void setObjectFactory(ITestObjectFactory objectFactory)
-
setParallel
@Deprecated public void setParallel(java.lang.String parallel)
Deprecated.Use #setParallel(XmlSuite.ParallelMode) instead
-
setParallel
public void setParallel(XmlSuite.ParallelMode parallel)
Sets the parallel mode- Parameters:
parallel
- the parallel mode
-
setParentModule
public void setParentModule(java.lang.String parentModule)
-
setGuiceStage
public void setGuiceStage(java.lang.String guiceStage)
-
setConfigFailurePolicy
public void setConfigFailurePolicy(XmlSuite.FailurePolicy configFailurePolicy)
Sets the configuration failure policy.- Parameters:
configFailurePolicy
- the config failure policy
-
getConfigFailurePolicy
public XmlSuite.FailurePolicy getConfigFailurePolicy()
Returns the configuration failure policy.- Returns:
- the configuration failure policy
-
getVerbose
public java.lang.Integer getVerbose()
Returns the verbose.- Returns:
- the verbose.
-
setVerbose
public void setVerbose(java.lang.Integer verbose)
Set the verbose.- Parameters:
verbose
- The verbose to set.
-
getName
public java.lang.String getName()
Returns the name.- Returns:
- the name.
-
setName
public void setName(java.lang.String name)
Sets the name.- Parameters:
name
- The name to set.
-
getTest
public java.lang.String getTest()
Returns the test.- Returns:
- the test.
-
getTests
public java.util.List<XmlTest> getTests()
Returns the tests.- Returns:
- the tests.
-
setTests
public void setTests(java.util.List<XmlTest> tests)
-
getMethodSelectors
public java.util.List<XmlMethodSelector> getMethodSelectors()
Returns the method selectors.- Returns:
- the method selectors.
-
setMethodSelectors
public void setMethodSelectors(java.util.List<XmlMethodSelector> methodSelectors)
Sets the method selectors.- Parameters:
methodSelectors
- the method selectors.
-
updateParameters
private void updateParameters()
Updates the list of parameters that apply to this XML suite. This method should be invoked any time there is a change in the state of this suite that would affect the parameter list.
NOTE: Currently being invoked after a parent suite is added or if parameters for this suite are updated.
-
setParameters
public void setParameters(java.util.Map<java.lang.String,java.lang.String> parameters)
Sets parameters.- Parameters:
parameters
- the parameters.
-
getParameters
public java.util.Map<java.lang.String,java.lang.String> getParameters()
Gets the parameters that apply to tests in this suite.
Set of parameters for a suite is appended with parameters from parent suite. Also, parameters from this suite override the same named parameters from parent suite.
-
getAllParameters
public java.util.Map<java.lang.String,java.lang.String> getAllParameters()
- Returns:
- The parameters defined in this suite and all its XmlTests.
-
getParameter
public java.lang.String getParameter(java.lang.String name)
Returns the parameter defined in this suite only.- Parameters:
name
- the parameter name.- Returns:
- The parameter defined in this suite only.
-
getThreadCount
public int getThreadCount()
- Returns:
- The threadCount.
-
setThreadCount
public void setThreadCount(int threadCount)
Set the thread count.- Parameters:
threadCount
- The thread count to set.
-
isJUnit
public java.lang.Boolean isJUnit()
- Returns:
- The JUnit compatibility flag.
-
setJUnit
public void setJUnit(java.lang.Boolean isJUnit)
Sets the JUnit compatibility flag.- Parameters:
isJUnit
- the JUnit compatibility flag.
-
setJunit
public void setJunit(java.lang.Boolean j)
-
skipFailedInvocationCounts
public java.lang.Boolean skipFailedInvocationCounts()
-
setSkipFailedInvocationCounts
public void setSkipFailedInvocationCounts(boolean skip)
-
setXmlPackages
public void setXmlPackages(java.util.List<XmlPackage> packages)
Sets the XML packages.- Parameters:
packages
- the XML packages.
-
getXmlPackages
public java.util.List<XmlPackage> getXmlPackages()
Returns the XML packages.- Returns:
- the XML packages.
-
getPackages
public java.util.List<XmlPackage> getPackages()
-
setMethodSelectors
public void setMethodSelectors(XmlMethodSelectors xms)
-
setPackages
public void setPackages(java.util.List<XmlPackage> packages)
-
toXml
public java.lang.String toXml()
- Returns:
- A String representation of this XML suite.
-
getLocalListeners
public java.util.List<java.lang.String> getLocalListeners()
- Returns:
- - The list of listener names that are local to the current <suite>
-
setXmlMethodSelectors
public void setXmlMethodSelectors(XmlMethodSelectors xms)
-
getXmlMethodSelectors
public XmlMethodSelectors getXmlMethodSelectors()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
clone
public java.lang.Object clone()
Note that this is not a full clone: XmlTest children are not cloned by this method.- Overrides:
clone
in classjava.lang.Object
-
shallowCopy
public XmlSuite shallowCopy()
This method returns a shallow cloned version.XmlTest
are not copied by this method.- Returns:
- - A Shallow copied version of
XmlSuite
.
-
setTimeOut
public void setTimeOut(java.lang.String timeOut)
Sets the timeout.- Parameters:
timeOut
- the timeout.
-
getTimeOut
public java.lang.String getTimeOut()
Returns the timeout.- Returns:
- the timeout.
-
getTimeOut
public long getTimeOut(long def)
Returns the timeout as a long value specifying the default value to be used if no timeout was specified.- Parameters:
def
- the the default value to be used if no timeout was specified.- Returns:
- the timeout as a long value specifying the default value to be used if no timeout was specified.
-
setSuiteFiles
public void setSuiteFiles(java.util.List<java.lang.String> files)
Sets the suite files.- Parameters:
files
- the suite files.
-
getSuiteFiles
public java.util.List<java.lang.String> getSuiteFiles()
Returns the suite files.- Returns:
- the suite files.
-
setListeners
public void setListeners(java.util.List<java.lang.String> listeners)
-
getListeners
public java.util.List<java.lang.String> getListeners()
-
setDataProviderThreadCount
public void setDataProviderThreadCount(int count)
-
getDataProviderThreadCount
public int getDataProviderThreadCount()
-
setParentSuite
public void setParentSuite(XmlSuite parentSuite)
-
getParentSuite
public XmlSuite getParentSuite()
-
getChildSuites
public java.util.List<XmlSuite> getChildSuites()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
f
static boolean f()
Used to debug equals() bugs.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
setPreserveOrder
@Deprecated public void setPreserveOrder(java.lang.String f)
Deprecated.UsesetPreserveOrder(Boolean)
instead
-
setPreserveOrder
public void setPreserveOrder(java.lang.Boolean f)
-
getPreserveOrder
public java.lang.Boolean getPreserveOrder()
-
getIncludedGroups
public java.util.List<java.lang.String> getIncludedGroups()
- Returns:
- Returns the includedGroups.
Note: do not modify the returned value, use
addIncludedGroup(String)
.
-
addIncludedGroup
public void addIncludedGroup(java.lang.String g)
-
setIncludedGroups
public void setIncludedGroups(java.util.List<java.lang.String> g)
- Parameters:
g
- - The list of groups to include.
-
setExcludedGroups
public void setExcludedGroups(java.util.List<java.lang.String> g)
- Parameters:
g
- The excludedGrousps to set.
-
getExcludedGroups
public java.util.List<java.lang.String> getExcludedGroups()
- Returns:
- Returns the excludedGroups.
Note: do not modify the returned value, use
addExcludedGroup(String)
.
-
addExcludedGroup
public void addExcludedGroup(java.lang.String g)
-
getGroupByInstances
public java.lang.Boolean getGroupByInstances()
-
setGroupByInstances
public void setGroupByInstances(boolean f)
-
addListener
public void addListener(java.lang.String listener)
-
getAllowReturnValues
public java.lang.Boolean getAllowReturnValues()
-
setAllowReturnValues
public void setAllowReturnValues(java.lang.Boolean allowReturnValues)
-
setGroups
public void setGroups(XmlGroups xmlGroups)
-
onParameterElement
public void onParameterElement(java.lang.String name, java.lang.String value)
-
onListenerElement
public void onListenerElement(java.lang.String className)
-
onSuiteFilesElement
public void onSuiteFilesElement(java.lang.String path)
-
onPackagesElement
public void onPackagesElement(java.lang.String name)
-
onMethodSelectorElement
public void onMethodSelectorElement(java.lang.String language, java.lang.String name, java.lang.String priority)
-
getGroups
public XmlGroups getGroups()
-
addTest
public void addTest(XmlTest test)
-
getPackageNames
public java.util.Collection<java.lang.String> getPackageNames()
-
-