Interface ReportProvider

  • All Superinterfaces:
    ReportCreator
    All Known Implementing Classes:
    AbstractReportProvider

    public interface ReportProvider
    extends ReportCreator
    The ReportProvider defines the interface that custom report providers must implement to take part in report generation.

    The process of generating the test report comprises of two steps:

    1. Data processing: Each data record logged during the test is passed to each report provider. If a report provider is not interested in a certain data record, it simply ignores it. Otherwise, it updates internal statistics. Note that the passed data records should not be stored internally as this may cause memory problems.
    2. Report fragment generation: After all data records have been processed, each report provider is asked to generate its share of the test report from the information gathered during data processing.

      The final test report is an XML file. Each report provider creates a section of the test report. However, the fragment returned need not be an XML snippet, but can be an ordinary structured Java object, for example:

       @XStreamAlias("general")
       public class GeneralReport
       {
           public long bytesSent;
       
           public long bytesReceived;
       
           public long hits;
       
           public Date startTime;
       
           public Date endTime;
       
           public int duration;
       }
       
      This object and its attributes are automatically converted to XML by the report generator framework:
       <general>
           <bytesSent>3911638522</bytesSent>
           <bytesReceived>368679396567</bytesReceived>
           <hits>23463398</hits>
           <startTime>2009-02-18 00:15:19.632 CET</startTime>
           <endTime>2009-02-18 08:20:57.951 CET</endTime>
           <duration>29138</duration>
         </general>
       
      This XML snippet is finally inserted into the test report.

      Note that this conversion to XML is done via the XStream library. This means, by using the XStream annotations @XStreamAlias and @XStreamImplicit with the report object, one has some control how the object's state is represented in XML.

    Report provider implementations must be registered with the framework by listing them in the file "xlt/config/reportgenerator.properties". This file may also be used to hold additional implementation specific configuration values. Use ReportProviderConfiguration.getProperties() to get access to these values.
    • Method Detail

      • processDataRecord

        void processDataRecord​(Data data)
        Processes the passed data record to gather information needed for the test report. Typically, only some internal statistics will be updated.
        Parameters:
        data - the data record to process
      • setConfiguration

        void setConfiguration​(ReportProviderConfiguration config)
        Sets the report provider's configuration. Use the configuration object to get access to general as well as provider-specific properties stored in the global configuration file.
        Parameters:
        config - the report provider configuration