Package org.testng.xml
Class XmlSuite
- java.lang.Object
-
- org.testng.xml.XmlSuite
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classXmlSuite.FailurePolicyConfiguration failure policy optionsstatic classXmlSuite.ParallelModeParallel modes
-
Field Summary
Fields Modifier and Type Field Description static BooleanDEFAULT_ALLOW_RETURN_VALUESstatic XmlSuite.FailurePolicyDEFAULT_CONFIG_FAILURE_POLICYWhether to SKIP or CONTINUE to re-attempt failed configuration methods.static IntegerDEFAULT_DATA_PROVIDER_THREAD_COUNTThread count for the data provider poolstatic BooleanDEFAULT_GROUP_BY_INSTANCESBy default, a method failing will cause all instances of that class to skipstatic BooleanDEFAULT_JUNITJUnit compatibility flag.static BooleanDEFAULT_MIXEDmixed mode flag.static XmlSuite.ParallelModeDEFAULT_PARALLELstatic BooleanDEFAULT_PRESERVE_ORDERstatic BooleanDEFAULT_SKIP_FAILED_INVOCATION_COUNTSstatic IntegerDEFAULT_THREAD_COUNTThe thread count.static IntegerDEFAULT_VERBOSEThe suite verbose flag.
-
Constructor Summary
Constructors Constructor Description XmlSuite()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddExcludedGroup(String g)voidaddIncludedGroup(String g)voidaddListener(String listener)voidaddTest(XmlTest test)Objectclone()Note that this is not a full clone: XmlTest children are not cloned by this method.booleanequals(Object obj)BooleangetAllowReturnValues()Map<String,String>getAllParameters()List<XmlSuite>getChildSuites()XmlSuite.FailurePolicygetConfigFailurePolicy()Returns the configuration failure policy.intgetDataProviderThreadCount()List<String>getExcludedGroups()StringgetFileName()BooleangetGroupByInstances()XmlGroupsgetGroups()StringgetGuiceStage()List<String>getIncludedGroups()List<String>getListeners()List<String>getLocalListeners()List<XmlMethodSelector>getMethodSelectors()Returns the method selectors.StringgetName()Returns the name.ITestObjectFactorygetObjectFactory()Collection<String>getPackageNames()List<XmlPackage>getPackages()XmlSuite.ParallelModegetParallel()Returns the parallel mode.StringgetParameter(String name)Returns the parameter defined in this suite only.Map<String,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.StringgetParentModule()XmlSuitegetParentSuite()BooleangetPreserveOrder()List<String>getSuiteFiles()Returns the suite files.StringgetTest()Returns the test.List<XmlTest>getTests()Returns the tests.intgetThreadCount()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.IntegergetVerbose()Returns the verbose.XmlMethodSelectorsgetXmlMethodSelectors()List<XmlPackage>getXmlPackages()Returns the XML packages.inthashCode()BooleanisJUnit()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)voidsetExcludedGroups(List<String> g)voidsetFileName(String fileName)voidsetGroupByInstances(boolean f)voidsetGroups(XmlGroups xmlGroups)voidsetGuiceStage(String guiceStage)voidsetIncludedGroups(List<String> g)voidsetJunit(Boolean j)voidsetJUnit(Boolean isJUnit)Sets the JUnit compatibility flag.voidsetListeners(List<String> listeners)voidsetMethodSelectors(List<XmlMethodSelector> methodSelectors)Sets the method selectors.voidsetMethodSelectors(XmlMethodSelectors xms)voidsetName(String name)Sets the name.voidsetObjectFactory(ITestObjectFactory objectFactory)voidsetPackages(List<XmlPackage> packages)voidsetParallel(String parallel)Deprecated.Use #setParallel(XmlSuite.ParallelMode) insteadvoidsetParallel(XmlSuite.ParallelMode parallel)Sets the parallel modevoidsetParameters(Map<String,String> parameters)Sets parameters.voidsetParentModule(String parentModule)voidsetParentSuite(XmlSuite parentSuite)voidsetParsed(boolean parsed)voidsetPreserveOrder(Boolean f)voidsetPreserveOrder(String f)Deprecated.UsesetPreserveOrder(Boolean)insteadvoidsetSkipFailedInvocationCounts(boolean skip)voidsetSuiteFiles(List<String> files)Sets the suite files.voidsetTests(List<XmlTest> tests)voidsetThreadCount(int threadCount)Set the thread count.voidsetTimeOut(String timeOut)Sets the timeout.voidsetVerbose(Integer verbose)Set the verbose.voidsetXmlMethodSelectors(XmlMethodSelectors xms)voidsetXmlPackages(List<XmlPackage> packages)Sets the XML packages.XmlSuiteshallowCopy()This method returns a shallow cloned version.BooleanskipFailedInvocationCounts()StringtoString()StringtoXml()
-
-
-
Field Detail
-
DEFAULT_VERBOSE
public static final Integer DEFAULT_VERBOSE
The suite verbose flag. (0 to 10)
-
DEFAULT_PARALLEL
public static final XmlSuite.ParallelMode DEFAULT_PARALLEL
-
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_JUNIT
public static final Boolean DEFAULT_JUNIT
JUnit compatibility flag.
-
DEFAULT_MIXED
public static final Boolean DEFAULT_MIXED
mixed mode flag.
-
DEFAULT_SKIP_FAILED_INVOCATION_COUNTS
public static final Boolean DEFAULT_SKIP_FAILED_INVOCATION_COUNTS
-
DEFAULT_THREAD_COUNT
public static final Integer DEFAULT_THREAD_COUNT
The thread count.
-
DEFAULT_DATA_PROVIDER_THREAD_COUNT
public static final Integer DEFAULT_DATA_PROVIDER_THREAD_COUNT
Thread count for the data provider pool
-
DEFAULT_GROUP_BY_INSTANCES
public static final 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 Boolean DEFAULT_ALLOW_RETURN_VALUES
-
DEFAULT_PRESERVE_ORDER
public static final 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 String getFileName()
- Returns:
- the fileName
-
setFileName
public void setFileName(String fileName)
- Parameters:
fileName- the fileName to set
-
getParallel
public XmlSuite.ParallelMode getParallel()
Returns the parallel mode.- Returns:
- the parallel mode.
-
getParentModule
public String getParentModule()
-
getGuiceStage
public String getGuiceStage()
-
getObjectFactory
public ITestObjectFactory getObjectFactory()
-
setObjectFactory
public void setObjectFactory(ITestObjectFactory objectFactory)
-
setParallel
@Deprecated public void setParallel(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(String parentModule)
-
setGuiceStage
public void setGuiceStage(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 Integer getVerbose()
Returns the verbose.- Returns:
- the verbose.
-
setVerbose
public void setVerbose(Integer verbose)
Set the verbose.- Parameters:
verbose- The verbose to set.
-
getName
public String getName()
Returns the name.- Returns:
- the name.
-
setName
public void setName(String name)
Sets the name.- Parameters:
name- The name to set.
-
getTest
public String getTest()
Returns the test.- Returns:
- the test.
-
getMethodSelectors
public List<XmlMethodSelector> getMethodSelectors()
Returns the method selectors.- Returns:
- the method selectors.
-
setMethodSelectors
public void setMethodSelectors(List<XmlMethodSelector> methodSelectors)
Sets the method selectors.- Parameters:
methodSelectors- the method selectors.
-
setParameters
public void setParameters(Map<String,String> parameters)
Sets parameters.- Parameters:
parameters- the parameters.
-
getParameters
public Map<String,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 Map<String,String> getAllParameters()
- Returns:
- The parameters defined in this suite and all its XmlTests.
-
getParameter
public String getParameter(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 Boolean isJUnit()
- Returns:
- The JUnit compatibility flag.
-
setJUnit
public void setJUnit(Boolean isJUnit)
Sets the JUnit compatibility flag.- Parameters:
isJUnit- the JUnit compatibility flag.
-
setJunit
public void setJunit(Boolean j)
-
skipFailedInvocationCounts
public Boolean skipFailedInvocationCounts()
-
setSkipFailedInvocationCounts
public void setSkipFailedInvocationCounts(boolean skip)
-
setXmlPackages
public void setXmlPackages(List<XmlPackage> packages)
Sets the XML packages.- Parameters:
packages- the XML packages.
-
getXmlPackages
public List<XmlPackage> getXmlPackages()
Returns the XML packages.- Returns:
- the XML packages.
-
getPackages
public List<XmlPackage> getPackages()
-
setMethodSelectors
public void setMethodSelectors(XmlMethodSelectors xms)
-
setPackages
public void setPackages(List<XmlPackage> packages)
-
toXml
public String toXml()
- Returns:
- A String representation of this XML suite.
-
getLocalListeners
public List<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()
-
clone
public Object clone()
Note that this is not a full clone: XmlTest children are not cloned by this method.
-
shallowCopy
public XmlSuite shallowCopy()
This method returns a shallow cloned version.XmlTestare not copied by this method.- Returns:
- - A Shallow copied version of
XmlSuite.
-
setTimeOut
public void setTimeOut(String timeOut)
Sets the timeout.- Parameters:
timeOut- the timeout.
-
getTimeOut
public 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(List<String> files)
Sets the suite files.- Parameters:
files- the suite files.
-
getSuiteFiles
public List<String> getSuiteFiles()
Returns the suite files.- Returns:
- the suite files.
-
setDataProviderThreadCount
public void setDataProviderThreadCount(int count)
-
getDataProviderThreadCount
public int getDataProviderThreadCount()
-
setParentSuite
public void setParentSuite(XmlSuite parentSuite)
-
getParentSuite
public XmlSuite getParentSuite()
-
setPreserveOrder
@Deprecated public void setPreserveOrder(String f)
Deprecated.UsesetPreserveOrder(Boolean)instead
-
setPreserveOrder
public void setPreserveOrder(Boolean f)
-
getPreserveOrder
public Boolean getPreserveOrder()
-
getIncludedGroups
public List<String> getIncludedGroups()
- Returns:
- Returns the includedGroups.
Note: do not modify the returned value, use
addIncludedGroup(String).
-
addIncludedGroup
public void addIncludedGroup(String g)
-
setIncludedGroups
public void setIncludedGroups(List<String> g)
- Parameters:
g- - The list of groups to include.
-
setExcludedGroups
public void setExcludedGroups(List<String> g)
- Parameters:
g- The excludedGrousps to set.
-
getExcludedGroups
public List<String> getExcludedGroups()
- Returns:
- Returns the excludedGroups.
Note: do not modify the returned value, use
addExcludedGroup(String).
-
addExcludedGroup
public void addExcludedGroup(String g)
-
getGroupByInstances
public Boolean getGroupByInstances()
-
setGroupByInstances
public void setGroupByInstances(boolean f)
-
addListener
public void addListener(String listener)
-
getAllowReturnValues
public Boolean getAllowReturnValues()
-
setAllowReturnValues
public void setAllowReturnValues(Boolean allowReturnValues)
-
setGroups
public void setGroups(XmlGroups xmlGroups)
-
onListenerElement
public void onListenerElement(String className)
-
onSuiteFilesElement
public void onSuiteFilesElement(String path)
-
onPackagesElement
public void onPackagesElement(String name)
-
onMethodSelectorElement
public void onMethodSelectorElement(String language, String name, String priority)
-
getGroups
public XmlGroups getGroups()
-
addTest
public void addTest(XmlTest test)
-
getPackageNames
public Collection<String> getPackageNames()
-
-