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.CloneableThis class describes the tag <suite> in testng.xml.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classXmlSuite.FailurePolicyConfiguration failure policy options.static classXmlSuite.ParallelModeParallel modes.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.BooleanDEFAULT_ALLOW_RETURN_VALUESstatic XmlSuite.FailurePolicyDEFAULT_CONFIG_FAILURE_POLICYWhether to SKIP or CONTINUE to re-attempt failed configuration methods.static java.lang.IntegerDEFAULT_DATA_PROVIDER_THREAD_COUNTThread count for the data provider pool.static java.lang.BooleanDEFAULT_GROUP_BY_INSTANCESBy default, a method failing will cause all instances of that class to skip.static java.lang.BooleanDEFAULT_MIXEDMixed mode flag.static XmlSuite.ParallelModeDEFAULT_PARALLELstatic java.lang.BooleanDEFAULT_PRESERVE_ORDERstatic java.lang.BooleanDEFAULT_SKIP_FAILED_INVOCATION_COUNTSstatic java.lang.IntegerDEFAULT_THREAD_COUNTThe thread count.static java.lang.IntegerDEFAULT_VERBOSEThe suite verbose flag (0 to 10).java.util.UUIDSUITE_IDRepresents a unique id for this suite.
-
Constructor Summary
Constructors Constructor Description XmlSuite()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddExcludedGroup(java.lang.String g)voidaddIncludedGroup(java.lang.String g)voidaddListener(java.lang.String listener)voidaddTest(XmlTest test)java.lang.Objectclone()Note that this is not a full clone: XmlTest children are not cloned by this method.booleanequals(java.lang.Object obj)java.lang.BooleangetAllowReturnValues()java.util.Map<java.lang.String,java.lang.String>getAllParameters()java.util.List<XmlSuite>getChildSuites()XmlSuite.FailurePolicygetConfigFailurePolicy()Returns the configuration failure policy.intgetDataProviderThreadCount()java.util.List<java.lang.String>getExcludedGroups()java.lang.StringgetFileName()java.lang.BooleangetGroupByInstances()XmlGroupsgetGroups()java.lang.StringgetGuiceStage()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.StringgetName()Returns the name.java.lang.Class<? extends ITestObjectFactory>getObjectFactoryClass()java.util.Collection<java.lang.String>getPackageNames()java.util.List<XmlPackage>getPackages()XmlSuite.ParallelModegetParallel()Returns the parallel mode.java.lang.StringgetParameter(java.lang.String name)Returns the parameter defined in this suite only.java.util.Map<java.lang.String,java.lang.String>getParameters()java.lang.StringgetParentModule()XmlSuitegetParentSuite()java.lang.BooleangetPreserveOrder()java.util.List<java.lang.String>getSuiteFiles()Returns the suite files.java.lang.StringgetTest()Returns the test.java.util.List<XmlTest>getTests()Returns the tests.intgetThreadCount()java.lang.StringgetTimeOut()Returns the timeout.longgetTimeOut(long def)Returns the timeout as a long value specifying the default value to be used if no timeout was specified.java.lang.IntegergetVerbose()Returns the verbose.XmlMethodSelectorsgetXmlMethodSelectors()java.util.List<XmlPackage>getXmlPackages()Returns the XML packages.inthashCode()booleanisParsed()booleanisShareThreadPoolForDataProviders()voidonListenerElement(java.lang.String className)voidonMethodSelectorElement(java.lang.String language, java.lang.String name, java.lang.String priority)voidonPackagesElement(java.lang.String name)voidonParameterElement(java.lang.String name, java.lang.String value)voidonSuiteFilesElement(java.lang.String path)voidsetAllowReturnValues(java.lang.Boolean allowReturnValues)voidsetConfigFailurePolicy(XmlSuite.FailurePolicy configFailurePolicy)Sets the configuration failure policy.voidsetDataProviderThreadCount(int count)voidsetExcludedGroups(java.util.List<java.lang.String> g)voidsetFileName(java.lang.String fileName)voidsetGroupByInstances(boolean f)voidsetGroups(XmlGroups xmlGroups)voidsetGuiceStage(java.lang.String guiceStage)voidsetIncludedGroups(java.util.List<java.lang.String> g)voidsetListeners(java.util.List<java.lang.String> listeners)voidsetMethodSelectors(java.util.List<XmlMethodSelector> methodSelectors)Sets the method selectors.voidsetMethodSelectors(XmlMethodSelectors xms)voidsetName(java.lang.String name)Sets the name.voidsetObjectFactoryClass(java.lang.Class<? extends ITestObjectFactory> objectFactoryClass)voidsetPackages(java.util.List<XmlPackage> packages)voidsetParallel(XmlSuite.ParallelMode parallel)Sets the parallel mode.voidsetParameters(java.util.Map<java.lang.String,java.lang.String> parameters)Sets parameters.voidsetParentModule(java.lang.String parentModule)voidsetParentSuite(XmlSuite parentSuite)voidsetParsed(boolean parsed)voidsetPreserveOrder(java.lang.Boolean f)voidsetShareThreadPoolForDataProviders(boolean shareThreadPoolForDataProviders)voidsetSkipFailedInvocationCounts(boolean skip)voidsetSuiteFiles(java.util.List<java.lang.String> files)Sets the suite files.voidsetTests(java.util.List<XmlTest> tests)voidsetThreadCount(int threadCount)Set the thread count.voidsetTimeOut(java.lang.String timeOut)Sets the timeout.voidsetVerbose(java.lang.Integer verbose)Set the verbose.voidsetXmlMethodSelectors(XmlMethodSelectors xms)voidsetXmlPackages(java.util.List<XmlPackage> packages)Sets the XML packages.XmlSuiteshallowCopy()This method returns a shallow cloned version.voidshouldUseGlobalThreadPool(boolean flag)java.lang.BooleanskipFailedInvocationCounts()java.lang.StringtoString()java.lang.StringtoXml()booleanuseGlobalThreadPool()
-
-
-
Field Detail
-
DEFAULT_VERBOSE
public static final java.lang.Integer DEFAULT_VERBOSE
The suite verbose flag (0 to 10).
-
DEFAULT_PARALLEL
public static final XmlSuite.ParallelMode DEFAULT_PARALLEL
-
SUITE_ID
public final java.util.UUID SUITE_ID
Represents a unique id for this suite. Can be used for uniquely identifying the xml suite.
-
DEFAULT_CONFIG_FAILURE_POLICY
public static final XmlSuite.FailurePolicy DEFAULT_CONFIG_FAILURE_POLICY
Whether to SKIP or CONTINUE to re-attempt failed configuration methods.
-
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
-
DEFAULT_THREAD_COUNT
public static final java.lang.Integer DEFAULT_THREAD_COUNT
The thread count.
-
DEFAULT_DATA_PROVIDER_THREAD_COUNT
public static final java.lang.Integer DEFAULT_DATA_PROVIDER_THREAD_COUNT
Thread count for the data provider pool.
-
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.
-
DEFAULT_ALLOW_RETURN_VALUES
public static final java.lang.Boolean DEFAULT_ALLOW_RETURN_VALUES
-
DEFAULT_PRESERVE_ORDER
public static final java.lang.Boolean DEFAULT_PRESERVE_ORDER
-
-
Method Detail
-
setParsed
public void setParsed(boolean parsed)
-
isParsed
public boolean isParsed()
- Returns:
- -
trueif the currentXmlSuitehas 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()
-
getObjectFactoryClass
public java.lang.Class<? extends ITestObjectFactory> getObjectFactoryClass()
-
setShareThreadPoolForDataProviders
public void setShareThreadPoolForDataProviders(boolean shareThreadPoolForDataProviders)
-
useGlobalThreadPool
public boolean useGlobalThreadPool()
-
shouldUseGlobalThreadPool
public void shouldUseGlobalThreadPool(boolean flag)
-
isShareThreadPoolForDataProviders
public boolean isShareThreadPoolForDataProviders()
-
setObjectFactoryClass
public void setObjectFactoryClass(java.lang.Class<? extends ITestObjectFactory> objectFactoryClass)
-
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.
-
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()
- 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
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.
-
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:
toStringin 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:
clonein classjava.lang.Object
-
shallowCopy
public XmlSuite shallowCopy()
This method returns a shallow cloned version.XmlTests 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 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:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
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()
-
-