Package org.testng.xml
Class XmlSuite
java.lang.Object
org.testng.xml.XmlSuite
- All Implemented Interfaces:
Cloneable
This class describes the tag <suite> in testng.xml.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Configuration failure policy options.static enum
Parallel modes. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Boolean
static final XmlSuite.FailurePolicy
Whether to SKIP or CONTINUE to re-attempt failed configuration methods.static final Integer
Thread count for the data provider pool.static final Boolean
By default, a method failing will cause all instances of that class to skip.static final Boolean
JUnit compatibility flag.static final Boolean
Mixed mode flag.static final XmlSuite.ParallelMode
static final Boolean
static final Boolean
private static final String
The default suite name TODO CQ is this OK as a default name.static final Integer
The thread count.static final Integer
The suite verbose flag (0 to 10).private Boolean
List of child XML suites specified using <suite-file> tags.private XmlSuite.FailurePolicy
private int
private String
Name of the XML file.private Boolean
private String
private Boolean
private List<XmlMethodSelector>
Suite level method selectors.private String
The suite name (defaults to DEFAULT_SUITE_NAME).private ITestObjectFactory
private XmlSuite.ParallelMode
Suite level parameters.private String
private XmlSuite
Parent XML suite if this suite was specified in another suite using <suite-file> tag.private Boolean
private Boolean
private String
Tests in suite.private int
private String
Time out for methods/tests.private Integer
private XmlGroups
private XmlMethodSelectors
private List<XmlPackage>
The packages containing test classes.private boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
void
addListener
(String listener) void
clone()
Note that this is not a full clone: XmlTest children are not cloned by this method.boolean
(package private) static boolean
f()
Used to debug equals() bugs.Returns the configuration failure policy.int
Returns the method selectors.getName()
Returns the name.Returns the parallel mode.getParameter
(String name) Returns the parameter defined in this suite only.Returns the suite files.getTest()
Returns the test.getTests()
Returns the tests.int
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.Returns the verbose.Returns the XML packages.int
hashCode()
isJUnit()
boolean
isParsed()
void
onListenerElement
(String className) void
onMethodSelectorElement
(String language, String name, String priority) void
onPackagesElement
(String name) void
onParameterElement
(String name, String value) void
onSuiteFilesElement
(String path) void
setAllowReturnValues
(Boolean allowReturnValues) void
setConfigFailurePolicy
(XmlSuite.FailurePolicy configFailurePolicy) Sets the configuration failure policy.void
setDataProviderThreadCount
(int count) void
void
setFileName
(String fileName) void
setGroupByInstances
(boolean f) void
void
setGuiceStage
(String guiceStage) void
void
void
Sets the JUnit compatibility flag.void
setListeners
(List<String> listeners) void
setMethodSelectors
(List<XmlMethodSelector> methodSelectors) Sets the method selectors.void
void
Sets the name.void
setObjectFactory
(ITestObjectFactory objectFactory) void
setPackages
(List<XmlPackage> packages) void
setParallel
(XmlSuite.ParallelMode parallel) Sets the parallel mode.void
setParameters
(Map<String, String> parameters) Sets parameters.void
setParentModule
(String parentModule) void
setParentSuite
(XmlSuite parentSuite) void
setParsed
(boolean parsed) void
void
setSkipFailedInvocationCounts
(boolean skip) void
setSuiteFiles
(List<String> files) Sets the suite files.void
void
setThreadCount
(int threadCount) Set the thread count.void
setTimeOut
(String timeOut) Sets the timeout.void
setVerbose
(Integer verbose) Set the verbose.void
void
setXmlPackages
(List<XmlPackage> packages) Sets the XML packages.This method returns a shallow cloned version.toString()
toXml()
private void
Updates the list of parameters that apply to this XML suite.
-
Field Details
-
m_test
-
DEFAULT_SUITE_NAME
The default suite name TODO CQ is this OK as a default name.- See Also:
-
m_name
The suite name (defaults to DEFAULT_SUITE_NAME). -
DEFAULT_VERBOSE
The suite verbose flag (0 to 10). -
m_verbose
-
DEFAULT_PARALLEL
-
m_parallel
-
m_parentModule
-
m_guiceStage
-
DEFAULT_CONFIG_FAILURE_POLICY
Whether to SKIP or CONTINUE to re-attempt failed configuration methods. -
m_configFailurePolicy
-
DEFAULT_JUNIT
JUnit compatibility flag. -
m_isJUnit
-
DEFAULT_MIXED
Mixed mode flag. -
DEFAULT_SKIP_FAILED_INVOCATION_COUNTS
-
m_skipFailedInvocationCounts
-
DEFAULT_THREAD_COUNT
The thread count. -
m_threadCount
private int m_threadCount -
DEFAULT_DATA_PROVIDER_THREAD_COUNT
Thread count for the data provider pool. -
m_dataProviderThreadCount
private int m_dataProviderThreadCount -
DEFAULT_GROUP_BY_INSTANCES
By default, a method failing will cause all instances of that class to skip. -
m_groupByInstances
-
DEFAULT_ALLOW_RETURN_VALUES
-
m_allowReturnValues
-
m_xmlPackages
The packages containing test classes. -
m_methodSelectors
Suite level method selectors. -
m_tests
Tests in suite. -
m_parameters
Suite level parameters. -
m_fileName
Name of the XML file. -
m_timeOut
Time out for methods/tests. -
m_childSuites
List of child XML suites specified using <suite-file> tags. -
m_parentSuite
Parent XML suite if this suite was specified in another suite using <suite-file> tag. -
m_suiteFiles
-
m_objectFactory
-
m_listeners
-
DEFAULT_PRESERVE_ORDER
-
m_preserveOrder
-
m_includedGroups
-
m_excludedGroups
-
m_xmlMethodSelectors
-
parsed
private boolean parsed -
m_xmlGroups
-
-
Constructor Details
-
XmlSuite
public XmlSuite()
-
-
Method Details
-
setParsed
public void setParsed(boolean parsed) -
isParsed
public boolean isParsed()- Returns:
- -
true
if the currentXmlSuite
has already been parsed.
-
getFileName
- Returns:
- The fileName.
-
setFileName
- Parameters:
fileName
- The fileName to set.
-
getParallel
Returns the parallel mode.- Returns:
- The parallel mode.
-
getParentModule
-
getGuiceStage
-
getObjectFactory
-
setObjectFactory
-
setParallel
Sets the parallel mode.- Parameters:
parallel
- The parallel mode.
-
setParentModule
-
setGuiceStage
-
setConfigFailurePolicy
Sets the configuration failure policy.- Parameters:
configFailurePolicy
- The config failure policy.
-
getConfigFailurePolicy
Returns the configuration failure policy.- Returns:
- The configuration failure policy.
-
getVerbose
Returns the verbose.- Returns:
- The verbose.
-
setVerbose
Set the verbose.- Parameters:
verbose
- The verbose to set.
-
getName
Returns the name.- Returns:
- The name.
-
setName
Sets the name.- Parameters:
name
- The name to set.
-
getTest
Returns the test.- Returns:
- The test.
-
getTests
Returns the tests.- Returns:
- The tests.
-
setTests
-
getMethodSelectors
Returns the method selectors.- Returns:
- The method selectors.
-
setMethodSelectors
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
Sets parameters.- Parameters:
parameters
- The parameters.
-
getParameters
- Returns:
- the parameters that apply to tests in this suite.
The set of parameters for a suite is appended with parameters from the parent suite. Also, parameters from this suite override the same named parameters from the parent suite.
-
getAllParameters
- Returns:
- The parameters defined in this suite and all its XmlTests.
-
getParameter
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
- Returns:
- The JUnit compatibility flag.
-
setJUnit
Sets the JUnit compatibility flag.- Parameters:
isJUnit
- The JUnit compatibility flag.
-
setJunit
-
skipFailedInvocationCounts
-
setSkipFailedInvocationCounts
public void setSkipFailedInvocationCounts(boolean skip) -
setXmlPackages
Sets the XML packages.- Parameters:
packages
- The XML packages.
-
getXmlPackages
Returns the XML packages.- Returns:
- The XML packages.
-
getPackages
-
setMethodSelectors
-
setPackages
-
toXml
- Returns:
- A String representation of this XML suite.
-
getLocalListeners
- Returns:
- - The list of listener names that are local to the current <suite>.
-
setXmlMethodSelectors
-
getXmlMethodSelectors
-
toString
-
clone
Note that this is not a full clone: XmlTest children are not cloned by this method. -
shallowCopy
This method returns a shallow cloned version.XmlTest
s are not copied by this method.- Returns:
- - A shallow copied version of
XmlSuite
.
-
setTimeOut
Sets the timeout.- Parameters:
timeOut
- The timeout.
-
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 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
Sets the suite files.- Parameters:
files
- The suite files.
-
getSuiteFiles
Returns the suite files.- Returns:
- The suite files.
-
setListeners
-
getListeners
-
setDataProviderThreadCount
public void setDataProviderThreadCount(int count) -
getDataProviderThreadCount
public int getDataProviderThreadCount() -
setParentSuite
-
getParentSuite
-
getChildSuites
-
hashCode
public int hashCode() -
f
static boolean f()Used to debug equals() bugs. -
equals
-
setPreserveOrder
-
getPreserveOrder
-
getIncludedGroups
- Returns:
- Returns the includedGroups. Note: do not modify the returned value, use
addIncludedGroup(String)
.
-
addIncludedGroup
-
setIncludedGroups
- Parameters:
g
- - The list of groups to include.
-
setExcludedGroups
- Parameters:
g
- The excludedGrousps to set.
-
getExcludedGroups
- Returns:
- Returns the excludedGroups. Note: do not modify the returned value, use
addExcludedGroup(String)
.
-
addExcludedGroup
-
getGroupByInstances
-
setGroupByInstances
public void setGroupByInstances(boolean f) -
addListener
-
getAllowReturnValues
-
setAllowReturnValues
-
setGroups
-
onParameterElement
-
onListenerElement
-
onSuiteFilesElement
-
onPackagesElement
-
onMethodSelectorElement
-
getGroups
-
addTest
-
getPackageNames
-