Top Description Fields Constructors Methods
org.testng.xml

public Class XmlTest

extends Object
implements Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable
Imports
java.util.*, org.testng.TestNGException, org.testng.collections.Lists, .Maps

This class describes the tag <test> in testng.xml.

Field Summary

Modifier and TypeField and Description
public static final int
private Boolean
private Map<String, List<Integer>>
private Boolean
private int
private List<XmlMethodSelector>
private String
private XmlSuite.ParallelMode
private Map<String, String>
private Boolean
private Boolean
private XmlSuite
private int
private String
private Integer
private List<XmlClass>
private Map<String, String>
private XmlGroups
private List<XmlPackage>

Constructor Summary

AccessConstructor and Description
public
XmlTest(XmlSuite
the parent suite.
suite
,
int
the index of this test tag in testng.xml
index
)

Constructs a XmlTest and adds it to suite's list of tests.

public
public

Method Summary

Modifier and TypeMethod and Description
public void
public void
public void
addMetaGroup(String name, List<String> metaGroup)

public void
addMetaGroup(String name, String... metaGroup)

public void
public void
public Object

Returns:

a clone of the current XmlTest
clone
()

Overrides java.lang.Object.clone.

Clone the source XmlTest by including: - test attributes - groups definitions - parameters

The <classes> sub element is ignored for the moment.

public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public Boolean
public Map<String, String>

Returns:

the parameters defined in this test tag and the tags above it.
getAllParameters
()

public List<XmlClass>
public List<String>
public boolean
public List<String>

Returns:

the includedGroups.
getIncludedGroups
()

public int

Returns:

The value
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.

public List<Integer>

Returns:

The invocation numbers of the method
getInvocationNumbers
(String
The method name
method
)

Convenience method to cache the ordering numbers for methods.

public Map<String, String>

Returns:

the parameters defined in this tag, and only this test tag. To retrieve the inherited parameters as well, call getAllParameters().
getLocalParameters
()

public Map<String, List<String>>

Returns:

Returns the metaGroups.
getMetaGroups
()

public List<XmlMethodSelector>
public String

Returns:

Returns the name.
getName
()

public List<XmlPackage>
public XmlSuite.ParallelMode
public String
public Boolean
public XmlScript
public final XmlSuite

Returns:

the suite this test is part of.
getSuite
()

Returns the suite this test is part of.

public int
public String
public long
getTimeOut(long def)

public int

Returns:

Returns the verbose.
getVerbose
()

public List<XmlClass>

Returns:

Returns the classes.
getXmlClasses
()

public Map<String, String>
public XmlGroups
public List<XmlPackage>
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.
private void
init(XmlSuite suite, int index)

public boolean
public boolean

Returns:

true if the current test's name matches with any of the given names.
nameMatchesAny
(List<String>
The list of names to check.
names
)

public void
setAllowReturnValues(Boolean allowReturnValues)

public void
public void
public void
public void
setGroups(XmlGroups xmlGroups)

public void
public void
setIndex(int index)

public void
public void
public void
setName(String
The name to set.
name
)

public void
public void
public void
setParameters(Map<String, String>
- A Map of parameters.
parameters
)

public void
setPreserveOrder(Boolean preserveOrder)

public void
public void
public void
public void
setThreadCount(int threadCount)

public void
setTimeOut(long timeOut)

private void
setTimeOut(String timeOut)

public void
setVerbose(int
- Verbosity level.
v
)

public void
setXmlClasses(List<XmlClass>
The classes to set.
classes
)

Sets the XML Classes.

public void
setXmlDependencyGroups(Map<String, String> xmlDependencyGroups)

public void
public void
public boolean

Returns:

Returns the isJUnit.
skipFailedInvocationCounts
()

public String
toXml(String indent)

Inherited from java.lang.Object:
finalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFAULT_TIMEOUT_MSback to summary
public static final int DEFAULT_TIMEOUT_MS
m_allowReturnValuesback to summary
private Boolean m_allowReturnValues
m_failedInvocationNumbersback to summary
private Map<String, List<Integer>> m_failedInvocationNumbers
m_groupByInstancesback to summary
private Boolean m_groupByInstances
m_indexback to summary
private int m_index
m_methodSelectorsback to summary
private List<XmlMethodSelector> m_methodSelectors
m_nameback to summary
private String m_name
m_parallelback to summary
private XmlSuite.ParallelMode m_parallel
m_parametersback to summary
private Map<String, String> m_parameters
m_preserveOrderback to summary
private Boolean m_preserveOrder
m_skipFailedInvocationCountsback to summary
private Boolean m_skipFailedInvocationCounts
m_suiteback to summary
private XmlSuite m_suite
m_threadCountback to summary
private int m_threadCount
m_timeOutback to summary
private String m_timeOut
m_verboseback to summary
private Integer m_verbose
m_xmlClassesback to summary
private List<XmlClass> m_xmlClasses
m_xmlDependencyGroupsback to summary
private Map<String, String> m_xmlDependencyGroups
m_xmlGroupsback to summary
private XmlGroups m_xmlGroups
m_xmlPackagesback to summary
private List<XmlPackage> m_xmlPackages

Constructor Detail

XmlTestback to summary
public XmlTest(XmlSuite suite, int index)

Constructs a XmlTest and adds it to suite's list of tests.

Parameters
suite:XmlSuite

the parent suite.

index:int

the index of this test tag in testng.xml

XmlTestback to summary
public XmlTest(XmlSuite suite)
XmlTestback to summary
public XmlTest()

Method Detail

addExcludedGroupback to summary
public void addExcludedGroup(String g)
addIncludedGroupback to summary
public void addIncludedGroup(String g)
addMetaGroupback to summary
public void addMetaGroup(String name, List<String> metaGroup)
addMetaGroupback to summary
public void addMetaGroup(String name, String... metaGroup)
addParameterback to summary
public void addParameter(String key, String value)
addXmlDependencyGroupback to summary
public void addXmlDependencyGroup(String group, String dependsOn)
cloneback to summary
public Object clone()

Overrides java.lang.Object.clone.

Clone the source XmlTest by including: - test attributes - groups definitions - parameters

The <classes> sub element is ignored for the moment.

Returns:Object

a clone of the current XmlTest

Annotations
@Override
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getAllowReturnValuesback to summary
public Boolean getAllowReturnValues()
getAllParametersback to summary
public Map<String, String> getAllParameters()
Returns:Map<String, String>

the parameters defined in this test tag and the tags above it.

getClassesback to summary
public List<XmlClass> getClasses()
getExcludedGroupsback to summary
public List<String> getExcludedGroups()
getGroupByInstancesback to summary
public boolean getGroupByInstances()
getIncludedGroupsback to summary
public List<String> getIncludedGroups()
Returns:List<String>

the includedGroups.

getIndexback to summary
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:int

The value

getInvocationNumbersback to summary
public List<Integer> getInvocationNumbers(String method)

Convenience method to cache the ordering numbers for methods.

Parameters
method:String

The method name

Returns:List<Integer>

The invocation numbers of the method

getLocalParametersback to summary
public Map<String, String> getLocalParameters()
Returns:Map<String, String>

the parameters defined in this tag, and only this test tag. To retrieve the inherited parameters as well, call getAllParameters().

getMetaGroupsback to summary
public Map<String, List<String>> getMetaGroups()
Returns:Map<String, List<String>>

Returns the metaGroups.

getMethodSelectorsback to summary
public List<XmlMethodSelector> getMethodSelectors()
getNameback to summary
public String getName()
Returns:String

Returns the name.

getPackagesback to summary
public List<XmlPackage> getPackages()
getParallelback to summary
public XmlSuite.ParallelMode getParallel()
getParameterback to summary
public String getParameter(String name)
getPreserveOrderback to summary
public Boolean getPreserveOrder()
getScriptback to summary
public XmlScript getScript()
getSuiteback to summary
public final XmlSuite getSuite()

Returns the suite this test is part of.

Returns:XmlSuite

the suite this test is part of.

getThreadCountback to summary
public int getThreadCount()
getTimeOutback to summary
public String getTimeOut()
getTimeOutback to summary
public long getTimeOut(long def)
getVerboseback to summary
public int getVerbose()
Returns:int

Returns the verbose.

getXmlClassesback to summary
public List<XmlClass> getXmlClasses()
Returns:List<XmlClass>

Returns the classes.

getXmlDependencyGroupsback to summary
public Map<String, String> getXmlDependencyGroups()
getXmlGroupsback to summary
public XmlGroups getXmlGroups()
getXmlPackagesback to summary
public List<XmlPackage> getXmlPackages()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
initback to summary
private void init(XmlSuite suite, int index)
isGroupFilteringDisabledback to summary
public boolean isGroupFilteringDisabled()
nameMatchesAnyback to summary
public boolean nameMatchesAny(List<String> names)
Parameters
names:List<String>

The list of names to check.

Returns:boolean

true if the current test's name matches with any of the given names.

setAllowReturnValuesback to summary
public void setAllowReturnValues(Boolean allowReturnValues)
setClassesback to summary
public void setClasses(List<XmlClass> c)
setExcludedGroupsback to summary
public void setExcludedGroups(List<String> g)
setGroupByInstancesback to summary
public void setGroupByInstances(boolean f)
setGroupsback to summary
public void setGroups(XmlGroups xmlGroups)
setIncludedGroupsback to summary
public void setIncludedGroups(List<String> g)
setIndexback to summary
public void setIndex(int index)
setMetaGroupsback to summary
public void setMetaGroups(Map<String, List<String>> metaGroups)
setMethodSelectorsback to summary
public void setMethodSelectors(List<XmlMethodSelector> methodSelectors)
setNameback to summary
public void setName(String name)
Parameters
name:String

The name to set.

setPackagesback to summary
public void setPackages(List<XmlPackage> p)
setParallelback to summary
public void setParallel(XmlSuite.ParallelMode parallel)
setParametersback to summary
public void setParameters(Map<String, String> parameters)
Parameters
parameters:Map<String, String>

- A Map of parameters.

setPreserveOrderback to summary
public void setPreserveOrder(Boolean preserveOrder)
setScriptback to summary
public void setScript(XmlScript script)
setSkipFailedInvocationCountsback to summary
public void setSkipFailedInvocationCounts(boolean skip)
setSuiteback to summary
public void setSuite(XmlSuite result)
setThreadCountback to summary
public void setThreadCount(int threadCount)
setTimeOutback to summary
public void setTimeOut(long timeOut)
setTimeOutback to summary
private void setTimeOut(String timeOut)
setVerboseback to summary
public void setVerbose(int v)
Parameters
v:int

- Verbosity level.

setXmlClassesback to summary
public void setXmlClasses(List<XmlClass> classes)

Sets the XML Classes.

Parameters
classes:List<XmlClass>

The classes to set.

setXmlDependencyGroupsback to summary
public void setXmlDependencyGroups(Map<String, String> xmlDependencyGroups)
setXmlPackagesback to summary
public void setXmlPackages(List<XmlPackage> packages)
setXmlSuiteback to summary
public void setXmlSuite(XmlSuite suite)
skipFailedInvocationCountsback to summary
public boolean skipFailedInvocationCounts()
Returns:boolean

Returns the isJUnit.

toXmlback to summary
public String toXml(String indent)