Package org.testng.xml
Class XmlTest
java.lang.Object
org.testng.xml.XmlTest
- All Implemented Interfaces:
Cloneable
This class describes the tag <test> in testng.xml.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intprivate Booleanprivate Booleanprivate intprivate Booleanprivate List<XmlMethodSelector> private Stringprivate XmlSuite.ParallelModeprivate Booleanprivate Booleanprivate XmlSuiteprivate intprivate Stringprivate Integerprivate XmlGroupsprivate List<XmlPackage> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidaddMetaGroup(String name, String... metaGroup) voidaddMetaGroup(String name, List<String> metaGroup) voidaddParameter(String key, String value) voidaddXmlDependencyGroup(String group, String dependsOn) clone()Clone thesourceXmlTestby including: - test attributes - groups definitions - parametersbooleanbooleanintgetIndex()Note that this attribute does not come from the XML file, it's calculated internally and represents the order in which this test tag was found in its <suite> tag.getInvocationNumbers(String method) Convenience method to cache the ordering numbers for methods.getName()getParameter(String name) final XmlSuitegetSuite()Returns the suite this test is part of.intlonggetTimeOut(long def) intinthashCode()private voidbooleanbooleanisJUnit()booleannameMatchesAny(List<String> names) voidsetAllowReturnValues(Boolean allowReturnValues) voidsetClasses(List<XmlClass> c) voidvoidsetGroupByInstances(boolean f) voidvoidvoidsetIndex(int index) voidsetJunit(boolean isJUnit) voidsetJUnit(boolean isJUnit) voidsetMetaGroups(Map<String, List<String>> metaGroups) voidsetMethodSelectors(List<XmlMethodSelector> methodSelectors) voidvoidvoidsetParallel(XmlSuite.ParallelMode parallel) voidsetParameters(Map<String, String> parameters) voidsetPreserveOrder(Boolean preserveOrder) voidvoidsetSkipFailedInvocationCounts(boolean skip) voidvoidsetThreadCount(int threadCount) voidsetTimeOut(long timeOut) private voidsetTimeOut(String timeOut) voidsetVerbose(int v) voidsetXmlClasses(List<XmlClass> classes) Sets the XML Classes.voidsetXmlDependencyGroups(Map<String, String> xmlDependencyGroups) voidsetXmlPackages(List<XmlPackage> packages) voidsetXmlSuite(XmlSuite suite) boolean
-
Field Details
-
DEFAULT_TIMEOUT_MS
public static final int DEFAULT_TIMEOUT_MS- See Also:
-
m_suite
-
m_name
-
m_verbose
-
m_isJUnit
-
m_threadCount
private int m_threadCount -
m_xmlClasses
-
m_parameters
-
m_parallel
-
m_methodSelectors
-
m_xmlPackages
-
m_timeOut
-
m_skipFailedInvocationCounts
-
m_failedInvocationNumbers
-
m_preserveOrder
-
m_index
private int m_index -
m_groupByInstances
-
m_allowReturnValues
-
m_xmlDependencyGroups
-
m_xmlGroups
-
-
Constructor Details
-
XmlTest
Constructs aXmlTestand adds it to suite's list of tests.- Parameters:
suite- the parent suite.index- the index of this test tag in testng.xml
-
XmlTest
-
XmlTest
public XmlTest()
-
-
Method Details
-
init
-
setXmlPackages
-
getXmlPackages
-
getPackages
-
setPackages
-
getMethodSelectors
-
setMethodSelectors
-
getSuite
Returns the suite this test is part of.- Returns:
- the suite this test is part of.
-
getIncludedGroups
- Returns:
- the includedGroups.
-
isGroupFilteringDisabled
public boolean isGroupFilteringDisabled() -
getXmlClasses
- Returns:
- Returns the classes.
-
getClasses
-
setClasses
-
setXmlClasses
Sets the XML Classes.- Parameters:
classes- The classes to set.
-
getName
- Returns:
- Returns the name.
-
setName
- Parameters:
name- The name to set.
-
setVerbose
public void setVerbose(int v) - Parameters:
v- - Verbosity level.
-
getThreadCount
public int getThreadCount() -
setThreadCount
public void setThreadCount(int threadCount) -
setIncludedGroups
-
setExcludedGroups
-
getExcludedGroups
-
addIncludedGroup
-
addExcludedGroup
-
getVerbose
public int getVerbose()- Returns:
- Returns the verbose.
-
getGroupByInstances
public boolean getGroupByInstances() -
setGroupByInstances
public void setGroupByInstances(boolean f) -
isJUnit
public boolean isJUnit()- Returns:
- Returns the isJUnit.
-
setJUnit
public void setJUnit(boolean isJUnit) - Parameters:
isJUnit- The isJUnit to set.
-
setJunit
public void setJunit(boolean isJUnit) -
setSkipFailedInvocationCounts
public void setSkipFailedInvocationCounts(boolean skip) -
skipFailedInvocationCounts
public boolean skipFailedInvocationCounts()- Returns:
- Returns the isJUnit.
-
addMetaGroup
-
addMetaGroup
-
setMetaGroups
-
getMetaGroups
- Returns:
- Returns the metaGroups.
-
setParameters
- Parameters:
parameters- - AMapof parameters.
-
addParameter
-
getParameter
-
getAllParameters
- Returns:
- the parameters defined in this test tag and the tags above it.
-
getLocalParameters
- Returns:
- the parameters defined in this tag, and only this test tag. To retrieve the inherited
parameters as well, call
getAllParameters().
-
setParallel
-
getParallel
-
getTimeOut
-
getTimeOut
public long getTimeOut(long def) -
setTimeOut
public void setTimeOut(long timeOut) -
setTimeOut
-
setScript
-
getScript
-
toXml
-
clone
Clone thesourceXmlTestby including: - test attributes - groups definitions - parametersThe <classes> sub element is ignored for the moment.
-
getInvocationNumbers
Convenience method to cache the ordering numbers for methods.- Parameters:
method- The method name- Returns:
- The invocation numbers of the method
-
setPreserveOrder
-
getPreserveOrder
-
setSuite
-
getAllowReturnValues
-
setAllowReturnValues
-
getIndex
public int getIndex()Note that this attribute does not come from the XML file, it's calculated internally and represents the order in which this test tag was found in its <suite> tag. It's used to calculate the ordering of the tests when preserve-test-order is true.- Returns:
- The value
-
setIndex
public void setIndex(int index) -
hashCode
public int hashCode() -
equals
-
addXmlDependencyGroup
-
getXmlDependencyGroups
-
setXmlDependencyGroups
-
setXmlSuite
-
setGroups
-
getXmlGroups
-
nameMatchesAny
- Parameters:
names- The list of names to check.- Returns:
trueif the current test's name matches with any of the given names.
-