org.testng.xml
Class XmlTest

java.lang.Object
  extended by org.testng.xml.XmlTest
All Implemented Interfaces:
Serializable, Cloneable

public class XmlTest
extends Object
implements Serializable, Cloneable

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

Author:
Cedric Beust, Alexandru Popescu
See Also:
Serialized Form

Field Summary
static int DEFAULT_TIMEOUT_MS
           
 
Constructor Summary
XmlTest()
           
XmlTest(XmlSuite suite)
           
XmlTest(XmlSuite suite, int index)
          Constructs a XmlTest and adds it to suite's list of tests.
 
Method Summary
 void addExcludedGroup(String g)
           
 void addIncludedGroup(String g)
           
 void addMetaGroup(String name, List<String> metaGroup)
           
 void addParameter(String key, String value)
           
 void addXmlDependencyGroup(String group, String dependsOn)
           
 Object clone()
          Clone the source XmlTest by including: - test attributes - groups definitions - parameters The <classes> sub element is ignored for the moment.
 boolean equals(Object obj)
           
 Boolean getAllowReturnValues()
           
 Map<String,String> getAllParameters()
           
 List<XmlClass> getClasses()
           
 List<String> getExcludedGroups()
           
 String getExpression()
           
 boolean getGroupByInstances()
           
 List<String> getIncludedGroups()
           
 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.
 List<Integer> getInvocationNumbers(String method)
          Convenience method to cache the ordering numbers for methods.
 Map<String,String> getLocalParameters()
           
 Map<String,List<String>> getMetaGroups()
           
 List<XmlMethodSelector> getMethodSelectors()
           
 String getName()
           
 List<XmlPackage> getPackages()
           
 String getParallel()
           
 String getParameter(String name)
           
 Map<String,String> getParameters()
          Deprecated. Use getLocalParameters() or getAllParameters()
 String getPreserveOrder()
           
 XmlSuite getSuite()
          Returns the suite this test is part of.
 Map<String,String> getTestParameters()
           
 int getThreadCount()
           
 String getTimeOut()
           
 long getTimeOut(long def)
           
 int getVerbose()
           
 List<XmlClass> getXmlClasses()
           
 Map<String,String> getXmlDependencyGroups()
           
 List<XmlPackage> getXmlPackages()
           
 int hashCode()
           
 boolean isJUnit()
           
 void setAllowReturnValues(Boolean allowReturnValues)
           
 void setBeanShellExpression(String expression)
           
 void setClasses(List<XmlClass> c)
           
 void setClassNames(List<XmlClass> classes)
          Deprecated. use setXmlClasses
 void setExcludedGroups(List<String> g)
           
 void setExpression(String expression)
           
 void setGroupByInstances(boolean f)
           
 void setGroups(XmlGroups xmlGroups)
           
 void setIncludedGroups(List<String> g)
           
 void setJunit(boolean isJUnit)
           
 void setJUnit(boolean isJUnit)
           
 void setMetaGroups(Map<String,List<String>> metaGroups)
           
 void setMethodSelectors(List<XmlMethodSelector> methodSelectors)
           
 void setName(String name)
           
 void setPackages(List<XmlPackage> p)
           
 void setParallel(String parallel)
           
 void setParameters(Map<String,String> parameters)
           
 void setPreserveOrder(String preserveOrder)
           
 void setSkipFailedInvocationCounts(boolean skip)
           
 void setSuite(XmlSuite result)
           
 void setThreadCount(int threadCount)
           
 void setTimeOut(long timeOut)
           
 void setVerbose(int v)
           
 void setXmlClasses(List<XmlClass> classes)
          Sets the XML Classes.
 void setXmlPackages(List<XmlPackage> packages)
           
 void setXmlSuite(XmlSuite suite)
           
 boolean skipFailedInvocationCounts()
           
 String toString()
           
 String toXml(String indent)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_TIMEOUT_MS

public static int DEFAULT_TIMEOUT_MS
Constructor Detail

XmlTest

public XmlTest(XmlSuite suite,
               int index)
Constructs a XmlTest and adds it to suite's list of tests.

Parameters:
suite - the parent suite.
index - the index of this test tag in testng.xml

XmlTest

public XmlTest(XmlSuite suite)

XmlTest

public XmlTest()
Method Detail

setXmlPackages

public void setXmlPackages(List<XmlPackage> packages)

getXmlPackages

public List<XmlPackage> getXmlPackages()

getPackages

public List<XmlPackage> getPackages()

setPackages

public void setPackages(List<XmlPackage> p)

getMethodSelectors

public List<XmlMethodSelector> getMethodSelectors()

setMethodSelectors

public void setMethodSelectors(List<XmlMethodSelector> methodSelectors)

getSuite

public XmlSuite getSuite()
Returns the suite this test is part of.

Returns:
the suite this test is part of.

getIncludedGroups

public List<String> getIncludedGroups()
Returns:
the includedGroups. Note: do not modify the returned value, use addIncludedGroup(String).

setClassNames

@Deprecated
public void setClassNames(List<XmlClass> classes)
Deprecated. use setXmlClasses

Sets the XML Classes.

Parameters:
classes - The classes to set.

getXmlClasses

public List<XmlClass> getXmlClasses()
Returns:
Returns the classes.

getClasses

public List<XmlClass> getClasses()

setClasses

public void setClasses(List<XmlClass> c)

setXmlClasses

public void setXmlClasses(List<XmlClass> classes)
Sets the XML Classes.

Parameters:
classes - The classes to set.

getName

public String getName()
Returns:
Returns the name.

setName

public void setName(String name)
Parameters:
name - The name to set.

setVerbose

public void setVerbose(int v)
Parameters:
v -

getThreadCount

public int getThreadCount()

setThreadCount

public void setThreadCount(int threadCount)

setIncludedGroups

public void setIncludedGroups(List<String> g)
Parameters:
g -

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).

addIncludedGroup

public void addIncludedGroup(String g)

addExcludedGroup

public void addExcludedGroup(String g)

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

public void addMetaGroup(String name,
                         List<String> metaGroup)

setMetaGroups

public void setMetaGroups(Map<String,List<String>> metaGroups)

getMetaGroups

public Map<String,List<String>> getMetaGroups()
Returns:
Returns the metaGroups.

setParameters

public void setParameters(Map<String,String> parameters)
Parameters:
parameters -

addParameter

public void addParameter(String key,
                         String value)

getParameter

public String getParameter(String name)

getAllParameters

public Map<String,String> getAllParameters()
Returns:
the parameters defined in this test tag and the tags above it.

getLocalParameters

public Map<String,String> getLocalParameters()
Returns:
the parameters defined in this tag, and only this test tag. To retrieve the inherited parameters as well, call getAllParameters().

getParameters

@Deprecated
public Map<String,String> getParameters()
Deprecated. Use getLocalParameters() or getAllParameters()


getTestParameters

public Map<String,String> getTestParameters()
Returns:
the parameters defined on this tag only

setParallel

public void setParallel(String parallel)

getParallel

public String getParallel()

getTimeOut

public String getTimeOut()

getTimeOut

public long getTimeOut(long def)

setTimeOut

public void setTimeOut(long timeOut)

setExpression

public void setExpression(String expression)

setBeanShellExpression

public void setBeanShellExpression(String expression)

getExpression

public String getExpression()

toXml

public String toXml(String indent)

toString

public String toString()
Overrides:
toString in class Object

clone

public Object clone()
Clone the source XmlTest by including: - test attributes - groups definitions - parameters The <classes> sub element is ignored for the moment.

Overrides:
clone in class Object
Returns:
a clone of the current XmlTest

getInvocationNumbers

public List<Integer> getInvocationNumbers(String method)
Convenience method to cache the ordering numbers for methods.


setPreserveOrder

public void setPreserveOrder(String preserveOrder)

getPreserveOrder

public String getPreserveOrder()

setSuite

public void setSuite(XmlSuite result)

getAllowReturnValues

public Boolean getAllowReturnValues()

setAllowReturnValues

public void setAllowReturnValues(Boolean allowReturnValues)

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.


hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

addXmlDependencyGroup

public void addXmlDependencyGroup(String group,
                                  String dependsOn)

getXmlDependencyGroups

public Map<String,String> getXmlDependencyGroups()

setXmlSuite

public void setXmlSuite(XmlSuite suite)

setGroups

public void setGroups(XmlGroups xmlGroups)


Copyright © 2015. All Rights Reserved.