Class XmlSuite

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

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

    • m_test

      private String m_test
    • DEFAULT_SUITE_NAME

      private static final String DEFAULT_SUITE_NAME
      The default suite name TODO CQ is this OK as a default name.
      See Also:
    • m_name

      private String m_name
      The suite name (defaults to DEFAULT_SUITE_NAME).
    • DEFAULT_VERBOSE

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

      private Integer m_verbose
    • DEFAULT_PARALLEL

      public static final XmlSuite.ParallelMode DEFAULT_PARALLEL
    • m_parallel

      private XmlSuite.ParallelMode m_parallel
    • m_parentModule

      private String m_parentModule
    • m_guiceStage

      private String m_guiceStage
    • DEFAULT_CONFIG_FAILURE_POLICY

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

      private XmlSuite.FailurePolicy m_configFailurePolicy
    • DEFAULT_JUNIT

      public static final Boolean DEFAULT_JUNIT
      JUnit compatibility flag.
    • m_isJUnit

      private Boolean m_isJUnit
    • 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
    • m_skipFailedInvocationCounts

      private Boolean m_skipFailedInvocationCounts
    • DEFAULT_THREAD_COUNT

      public static final Integer DEFAULT_THREAD_COUNT
      The thread count.
    • m_threadCount

      private int m_threadCount
    • DEFAULT_DATA_PROVIDER_THREAD_COUNT

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

      private int m_dataProviderThreadCount
    • 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.
    • m_groupByInstances

      private Boolean m_groupByInstances
    • DEFAULT_ALLOW_RETURN_VALUES

      public static final Boolean DEFAULT_ALLOW_RETURN_VALUES
    • m_allowReturnValues

      private Boolean m_allowReturnValues
    • m_xmlPackages

      private List<XmlPackage> m_xmlPackages
      The packages containing test classes.
    • m_methodSelectors

      private List<XmlMethodSelector> m_methodSelectors
      Suite level method selectors.
    • m_tests

      private List<XmlTest> m_tests
      Tests in suite.
    • m_parameters

      private Map<String,String> m_parameters
      Suite level parameters.
    • m_fileName

      private String m_fileName
      Name of the XML file.
    • m_timeOut

      private String m_timeOut
      Time out for methods/tests.
    • m_childSuites

      private final List<XmlSuite> m_childSuites
      List of child XML suites specified using <suite-file> tags.
    • m_parentSuite

      private XmlSuite m_parentSuite
      Parent XML suite if this suite was specified in another suite using <suite-file> tag.
    • m_suiteFiles

      private List<String> m_suiteFiles
    • m_objectFactory

      private ITestObjectFactory m_objectFactory
    • m_listeners

      private List<String> m_listeners
    • DEFAULT_PRESERVE_ORDER

      public static final Boolean DEFAULT_PRESERVE_ORDER
    • m_preserveOrder

      private Boolean m_preserveOrder
    • m_includedGroups

      private List<String> m_includedGroups
    • m_excludedGroups

      private List<String> m_excludedGroups
    • m_xmlMethodSelectors

      private XmlMethodSelectors m_xmlMethodSelectors
    • parsed

      private boolean parsed
    • m_xmlGroups

      private XmlGroups m_xmlGroups
  • Constructor Details

    • XmlSuite

      public XmlSuite()
  • Method Details

    • 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()
    • getObjectFactory

      public ITestObjectFactory getObjectFactory()
    • setObjectFactory

      public void setObjectFactory(ITestObjectFactory objectFactory)
    • 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.
    • updateParameters

      private void updateParameters()
      Updates the list of parameters that apply to this XML suite. This method should be invoked any time there is a change in the state of this suite that would affect the parameter list.
      NOTE: Currently being invoked after a parent suite is added or if parameters for this suite are updated.
    • setParameters

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

      public Map<String,String> getParameters()
      Returns:
      the parameters that apply to tests in this suite.
      The set of parameters for a suite is appended with parameters from the parent suite. Also, parameters from this suite override the same named parameters from the 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.
    • getPackages

      public List<XmlPackage> getPackages()
    • setMethodSelectors

      public void setMethodSelectors(XmlMethodSelectors xms)
    • 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>.
    • setXmlMethodSelectors

      public void setXmlMethodSelectors(XmlMethodSelectors xms)
    • getXmlMethodSelectors

      public XmlMethodSelectors getXmlMethodSelectors()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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. XmlTests 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 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()
    • getChildSuites

      public List<XmlSuite> getChildSuites()
    • hashCode

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

      static boolean f()
      Used to debug equals() bugs.
    • equals

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

      public void setPreserveOrder(Boolean f)
    • getPreserveOrder

      public Boolean getPreserveOrder()
    • getIncludedGroups

      public List<String> getIncludedGroups()
      Returns:
      Returns the includedGroups. Note: do not modify the returned value, use addIncludedGroup(String).
    • 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.
    • getExcludedGroups

      public List<String> getExcludedGroups()
      Returns:
      Returns the excludedGroups. Note: do not modify the returned value, use addExcludedGroup(String).
    • 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)
    • getGroups

      public XmlGroups getGroups()
    • addTest

      public void addTest(XmlTest test)
    • getPackageNames

      public Collection<String> getPackageNames()