Class XmlTest

  • All Implemented Interfaces:
    Cloneable

    public class XmlTest
    extends Object
    implements Cloneable
    This class describes the tag <test> in testng.xml.
    • 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)
      • 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.
      • 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.
      • 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)
      • 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)
      • addMetaGroup

        public void addMetaGroup​(String name,
                                 String... metaGroup)
      • 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().
      • getParameters

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

        @Deprecated
        public Map<String,​String> getTestParameters()
        Deprecated.
        Use getLocalParameters() instead
        Returns:
        the parameters defined on this tag only
      • 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()
      • 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​(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.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode 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)
      • 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.