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 enumConfiguration failure policy options.static enumParallel modes. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Booleanstatic final XmlSuite.FailurePolicyWhether to SKIP or CONTINUE to re-attempt failed configuration methods.static final IntegerThread count for the data provider pool.static final BooleanBy default, a method failing will cause all instances of that class to skip.static final BooleanJUnit compatibility flag.static final BooleanMixed mode flag.static final XmlSuite.ParallelModestatic final Booleanstatic final Booleanprivate static final StringThe default suite name TODO CQ is this OK as a default name.static final IntegerThe thread count.static final IntegerThe suite verbose flag (0 to 10).private BooleanList of child XML suites specified using invalid input: '<'suite-file> tags.private XmlSuite.FailurePolicyprivate intprivate StringName of the XML file.private Booleanprivate Stringprivate Booleanprivate List<XmlMethodSelector> Suite level method selectors.private StringThe suite name (defaults to DEFAULT_SUITE_NAME).private Class<? extends ITestObjectFactory> private XmlSuite.ParallelModeSuite level parameters.private Stringprivate XmlSuiteParent XML suite if this suite was specified in another suite using invalid input: '<'suite-file> tag.private Booleanprivate Booleanprivate StringTests in suite.private intprivate StringTime out for methods/tests.private Integerprivate XmlGroupsprivate XmlMethodSelectorsprivate List<XmlPackage> The packages containing test classes.private boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidaddListener(String listener) voidclone()Note that this is not a full clone: XmlTest children are not cloned by this method.boolean(package private) static booleanf()Used to debug equals() bugs.Returns the configuration failure policy.intReturns the method selectors.getName()Returns the name.Deprecated.Class<? extends ITestObjectFactory> 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.intReturns the timeout.longgetTimeOut(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.inthashCode()isJUnit()booleanisParsed()voidonListenerElement(String className) voidonMethodSelectorElement(String language, String name, String priority) voidonPackagesElement(String name) voidonParameterElement(String name, String value) voidonSuiteFilesElement(String path) voidsetAllowReturnValues(Boolean allowReturnValues) voidsetConfigFailurePolicy(XmlSuite.FailurePolicy configFailurePolicy) Sets the configuration failure policy.voidsetDataProviderThreadCount(int count) voidvoidsetFileName(String fileName) voidsetGroupByInstances(boolean f) voidvoidsetGuiceStage(String guiceStage) voidvoidvoidSets the JUnit compatibility flag.voidsetListeners(List<String> listeners) voidsetMethodSelectors(List<XmlMethodSelector> methodSelectors) Sets the method selectors.voidvoidSets the name.voidsetObjectFactory(ITestObjectFactory objectFactory) Deprecated.voidsetObjectFactoryClass(Class<? extends ITestObjectFactory> objectFactoryClass) voidsetPackages(List<XmlPackage> packages) voidsetParallel(XmlSuite.ParallelMode parallel) Sets the parallel mode.voidsetParameters(Map<String, String> parameters) Sets parameters.voidsetParentModule(String parentModule) voidsetParentSuite(XmlSuite parentSuite) voidsetParsed(boolean parsed) voidvoidsetSkipFailedInvocationCounts(boolean skip) voidsetSuiteFiles(List<String> files) Sets the suite files.voidvoidsetThreadCount(int threadCount) Set the thread count.voidsetTimeOut(String timeOut) Sets the timeout.voidsetVerbose(Integer verbose) Set the verbose.voidvoidsetXmlPackages(List<XmlPackage> packages) Sets the XML packages.This method returns a shallow cloned version.toString()toXml()private voidUpdates 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 invalid input: '<'suite-file> tags. -
m_parentSuite
Parent XML suite if this suite was specified in another suite using invalid input: '<'suite-file> tag. -
m_suiteFiles
-
m_objectFactoryClass
-
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:
- -
trueif the currentXmlSuitehas 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
Deprecated.- This method stands deprecated as of TestNG7.5.0. UsegetObjectFactoryClass()instead.- Returns:
- - A
ITestObjectFactoryinstance.
-
getObjectFactoryClass
-
setObjectFactory
Deprecated. -
setObjectFactoryClass
-
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.XmlTests 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
-
7.5.0.