Class XmlSuite

  • All Implemented Interfaces:
    Cloneable

    public class XmlSuite
    extends Object
    implements Cloneable
    This class describes the tag <suite> in testng.xml.
    • Field Detail

      • DEFAULT_VERBOSE

        public static final Integer DEFAULT_VERBOSE
        The suite verbose flag. (0 to 10)
      • DEFAULT_CONFIG_FAILURE_POLICY

        public static final XmlSuite.FailurePolicy DEFAULT_CONFIG_FAILURE_POLICY
        Whether to SKIP or CONTINUE to re-attempt failed configuration methods.
      • DEFAULT_JUNIT

        public static final Boolean DEFAULT_JUNIT
        JUnit compatibility flag.
      • DEFAULT_MIXED

        public static final Boolean DEFAULT_MIXED
        mixed mode flag.
      • DEFAULT_SKIP_FAILED_INVOCATION_COUNTS

        public static final Boolean DEFAULT_SKIP_FAILED_INVOCATION_COUNTS
      • DEFAULT_THREAD_COUNT

        public static final Integer DEFAULT_THREAD_COUNT
        The thread count.
      • DEFAULT_DATA_PROVIDER_THREAD_COUNT

        public static final Integer DEFAULT_DATA_PROVIDER_THREAD_COUNT
        Thread count for the data provider pool
      • DEFAULT_GROUP_BY_INSTANCES

        public static final Boolean DEFAULT_GROUP_BY_INSTANCES
        By default, a method failing will cause all instances of that class to skip
      • DEFAULT_ALLOW_RETURN_VALUES

        public static final Boolean DEFAULT_ALLOW_RETURN_VALUES
      • DEFAULT_PRESERVE_ORDER

        public static final Boolean DEFAULT_PRESERVE_ORDER
    • Constructor Detail

      • XmlSuite

        public XmlSuite()
    • Method Detail

      • setParsed

        public void setParsed​(boolean parsed)
      • isParsed

        public boolean isParsed()
        Returns:
        - true if the current XmlSuite has already been parsed.
      • getFileName

        public String getFileName()
        Returns:
        the fileName
      • setFileName

        public void setFileName​(String fileName)
        Parameters:
        fileName - the fileName to set
      • getParallel

        public XmlSuite.ParallelMode getParallel()
        Returns the parallel mode.
        Returns:
        the parallel mode.
      • getParentModule

        public String getParentModule()
      • getGuiceStage

        public String getGuiceStage()
      • setParallel

        @Deprecated
        public void setParallel​(String parallel)
        Deprecated.
        Use #setParallel(XmlSuite.ParallelMode) instead
      • setParallel

        public void setParallel​(XmlSuite.ParallelMode parallel)
        Sets the parallel mode
        Parameters:
        parallel - the parallel mode
      • setParentModule

        public void setParentModule​(String parentModule)
      • setGuiceStage

        public void setGuiceStage​(String guiceStage)
      • setConfigFailurePolicy

        public void setConfigFailurePolicy​(XmlSuite.FailurePolicy configFailurePolicy)
        Sets the configuration failure policy.
        Parameters:
        configFailurePolicy - the config failure policy
      • getConfigFailurePolicy

        public XmlSuite.FailurePolicy getConfigFailurePolicy()
        Returns the configuration failure policy.
        Returns:
        the configuration failure policy
      • getVerbose

        public Integer getVerbose()
        Returns the verbose.
        Returns:
        the verbose.
      • setVerbose

        public void setVerbose​(Integer verbose)
        Set the verbose.
        Parameters:
        verbose - The verbose to set.
      • getName

        public String getName()
        Returns the name.
        Returns:
        the name.
      • setName

        public void setName​(String name)
        Sets the name.
        Parameters:
        name - The name to set.
      • getTest

        public String getTest()
        Returns the test.
        Returns:
        the test.
      • getTests

        public List<XmlTest> getTests()
        Returns the tests.
        Returns:
        the tests.
      • setTests

        public void setTests​(List<XmlTest> tests)
      • getMethodSelectors

        public List<XmlMethodSelector> getMethodSelectors()
        Returns the method selectors.
        Returns:
        the method selectors.
      • setMethodSelectors

        public void setMethodSelectors​(List<XmlMethodSelector> methodSelectors)
        Sets the method selectors.
        Parameters:
        methodSelectors - the method selectors.
      • setParameters

        public void setParameters​(Map<String,​String> parameters)
        Sets parameters.
        Parameters:
        parameters - the parameters.
      • getParameters

        public Map<String,​String> getParameters()
        Gets the parameters that apply to tests in this suite.
        Set of parameters for a suite is appended with parameters from parent suite. Also, parameters from this suite override the same named parameters from parent suite.
      • getAllParameters

        public Map<String,​String> getAllParameters()
        Returns:
        The parameters defined in this suite and all its XmlTests.
      • getParameter

        public String getParameter​(String name)
        Returns the parameter defined in this suite only.
        Parameters:
        name - the parameter name.
        Returns:
        The parameter defined in this suite only.
      • getThreadCount

        public int getThreadCount()
        Returns:
        The threadCount.
      • setThreadCount

        public void setThreadCount​(int threadCount)
        Set the thread count.
        Parameters:
        threadCount - The thread count to set.
      • isJUnit

        public Boolean isJUnit()
        Returns:
        The JUnit compatibility flag.
      • setJUnit

        public void setJUnit​(Boolean isJUnit)
        Sets the JUnit compatibility flag.
        Parameters:
        isJUnit - the JUnit compatibility flag.
      • setJunit

        public void setJunit​(Boolean j)
      • skipFailedInvocationCounts

        public Boolean skipFailedInvocationCounts()
      • setSkipFailedInvocationCounts

        public void setSkipFailedInvocationCounts​(boolean skip)
      • setXmlPackages

        public void setXmlPackages​(List<XmlPackage> packages)
        Sets the XML packages.
        Parameters:
        packages - the XML packages.
      • getXmlPackages

        public List<XmlPackage> getXmlPackages()
        Returns the XML packages.
        Returns:
        the XML packages.
      • setPackages

        public void setPackages​(List<XmlPackage> packages)
      • toXml

        public String toXml()
        Returns:
        A String representation of this XML suite.
      • getLocalListeners

        public List<String> getLocalListeners()
        Returns:
        - The list of listener names that are local to the current <suite>
      • clone

        public Object clone()
        Note that this is not a full clone: XmlTest children are not cloned by this method.
        Overrides:
        clone in class Object
      • shallowCopy

        public XmlSuite shallowCopy()
        This method returns a shallow cloned version. XmlTest are not copied by this method.
        Returns:
        - A Shallow copied version of XmlSuite.
      • setTimeOut

        public void setTimeOut​(String timeOut)
        Sets the timeout.
        Parameters:
        timeOut - the timeout.
      • getTimeOut

        public String getTimeOut()
        Returns the timeout.
        Returns:
        the timeout.
      • getTimeOut

        public long getTimeOut​(long def)
        Returns the timeout as a long value specifying the default value to be used if no timeout was specified.
        Parameters:
        def - the the default value to be used if no timeout was specified.
        Returns:
        the timeout as a long value specifying the default value to be used if no timeout was specified.
      • setSuiteFiles

        public void setSuiteFiles​(List<String> files)
        Sets the suite files.
        Parameters:
        files - the suite files.
      • getSuiteFiles

        public List<String> getSuiteFiles()
        Returns the suite files.
        Returns:
        the suite files.
      • setListeners

        public void setListeners​(List<String> listeners)
      • getListeners

        public List<String> getListeners()
      • setDataProviderThreadCount

        public void setDataProviderThreadCount​(int count)
      • getDataProviderThreadCount

        public int getDataProviderThreadCount()
      • setParentSuite

        public void setParentSuite​(XmlSuite parentSuite)
      • getParentSuite

        public XmlSuite getParentSuite()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • setPreserveOrder

        public void setPreserveOrder​(Boolean f)
      • getPreserveOrder

        public Boolean getPreserveOrder()
      • addIncludedGroup

        public void addIncludedGroup​(String g)
      • setIncludedGroups

        public void setIncludedGroups​(List<String> g)
        Parameters:
        g - - The list of groups to include.
      • setExcludedGroups

        public void setExcludedGroups​(List<String> g)
        Parameters:
        g - The excludedGrousps to set.
      • addExcludedGroup

        public void addExcludedGroup​(String g)
      • getGroupByInstances

        public Boolean getGroupByInstances()
      • setGroupByInstances

        public void setGroupByInstances​(boolean f)
      • addListener

        public void addListener​(String listener)
      • getAllowReturnValues

        public Boolean getAllowReturnValues()
      • setAllowReturnValues

        public void setAllowReturnValues​(Boolean allowReturnValues)
      • setGroups

        public void setGroups​(XmlGroups xmlGroups)
      • onParameterElement

        public void onParameterElement​(String name,
                                       String value)
      • onListenerElement

        public void onListenerElement​(String className)
      • onSuiteFilesElement

        public void onSuiteFilesElement​(String path)
      • onPackagesElement

        public void onPackagesElement​(String name)
      • onMethodSelectorElement

        public void onMethodSelectorElement​(String language,
                                            String name,
                                            String priority)
      • addTest

        public void addTest​(XmlTest test)