Class XMLReporter

java.lang.Object
org.testng.reporters.XMLReporter
All Implemented Interfaces:
IReporter, ITestNGListener, ICustomizeXmlReport

public class XMLReporter extends Object implements IReporter, ICustomizeXmlReport
The main entry for the XML generation operation
  • Field Details

  • Constructor Details

    • XMLReporter

      public XMLReporter()
  • Method Details

    • generateReport

      public void generateReport(List<XmlSuite> xmlSuites, List<ISuite> suites, String outputDirectory)
      Description copied from interface: IReporter
      Generate a report for the given suites into the specified output directory.
      Specified by:
      generateReport in interface IReporter
      Parameters:
      xmlSuites - The list of XmlSuite
      suites - The list of ISuite
      outputDirectory - The output directory
    • addCustomTagsFor

      public void addCustomTagsFor(XMLStringBuffer xmlBuffer, ITestResult testResult)
      Specified by:
      addCustomTagsFor in interface ICustomizeXmlReport
      Parameters:
      xmlBuffer - - An XMLStringBuffer object that represents the buffer to be used.
      testResult - - An ITestResult object that represents a test method's result.
    • fileName

      public String fileName()
    • writeReporterOutput

      private void writeReporterOutput(XMLStringBuffer xmlBuffer)
    • writeSuite

      private void writeSuite(ISuite suite)
    • writeSuiteToFile

      private void writeSuiteToFile(File suiteFile, ISuite suite)
    • referenceSuite

      private File referenceSuite(XMLStringBuffer xmlBuffer, ISuite suite)
    • writeSuiteToBuffer

      private void writeSuiteToBuffer(XMLStringBuffer xmlBuffer, ISuite suite)
    • writeSuiteGroups

      private void writeSuiteGroups(XMLStringBuffer xmlBuffer, ISuite suite)
    • getSuiteAttributes

      private Properties getSuiteAttributes(ISuite suite)
    • addDurationAttributes

      public static void addDurationAttributes(XMLReporterConfig config, Properties attributes, Date minStartDate, Date maxEndDate)
      Add started-at, finished-at and duration-ms attributes to the <suite> tag
      Parameters:
      config - The reporter config
      attributes - The properties
      minStartDate - The minimum start date
      maxEndDate - The maximum end date
    • getUniqueMethodSet

      private Set<ITestNGMethod> getUniqueMethodSet(Collection<ITestNGMethod> methods)
    • getConfig

      public XMLReporterConfig getConfig()
      Description copied from interface: IReporter
      Get the reporter configuration object.

      NOTE: Reporter configuration objects must adhere to the JavaBean object conventions, providing getter and setter methods that conform to standard naming rules. This enables ReporterConfig to serialize, deserialize, and instantiate the reporter.

      Specified by:
      getConfig in interface IReporter
      Returns:
      reporter configuration object