Class XmlTest

java.lang.Object
org.testng.xml.XmlTest
All Implemented Interfaces:
Cloneable

public class XmlTest extends Object implements Cloneable
This class describes the tag <test> in testng.xml.
  • Field Details

  • Constructor Details

    • 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 Details

    • 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 final 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.
    • isGroupFilteringDisabled

      public boolean isGroupFilteringDisabled()
    • 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 - - Verbosity level.
    • getThreadCount

      public int getThreadCount()
    • setThreadCount

      public void setThreadCount(int threadCount)
    • setIncludedGroups

      public void setIncludedGroups(List<String> g)
    • setExcludedGroups

      public void setExcludedGroups(List<String> g)
    • getExcludedGroups

      public List<String> getExcludedGroups()
    • 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)
    • setSkipFailedInvocationCounts

      public void setSkipFailedInvocationCounts(boolean skip)
    • skipFailedInvocationCounts

      public boolean skipFailedInvocationCounts()
      Returns:
      Returns the isJUnit.
    • addMetaGroup

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

      public void addMetaGroup(String name, 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 - - A Map of 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().
    • setParallel

      public void setParallel(XmlSuite.ParallelMode parallel)
    • getParallel

      public XmlSuite.ParallelMode getParallel()
    • getTimeOut

      public String getTimeOut()
    • getTimeOut

      public long getTimeOut(long def)
    • setTimeOut

      public void setTimeOut(long timeOut)
    • setScript

      public void setScript(XmlScript script)
    • getScript

      public XmlScript getScript()
    • toXml

      public String toXml(String indent)
    • 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.
      Parameters:
      method - The method name
      Returns:
      The invocation numbers of the method
    • setPreserveOrder

      public void setPreserveOrder(Boolean preserveOrder)
    • getPreserveOrder

      public Boolean 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.
      Returns:
      The value
    • setIndex

      public void setIndex(int index)
    • 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()
    • setXmlDependencyGroups

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

      public void setXmlSuite(XmlSuite suite)
    • setGroups

      public void setGroups(XmlGroups xmlGroups)
    • getXmlGroups

      public XmlGroups getXmlGroups()
    • nameMatchesAny

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