com.hp.lft.report

Class Reporter



  • public class Reporter
    extends java.lang.Object
    Accesses the LeanFT HTML Report.
    • Constructor Summary

      Constructor and Description
      Reporter() 
    • Method Summary

      Modifier and Type Method and Description
      static void addRunInformation(java.lang.String fieldName, java.lang.String fieldValue)
      Adds a custom entry to the top section of the LeanFT report.
      static void endReportingContext()
      Ends the section in the LeanFT report.
      static void endTest()
      Ends the current test level and sets the test status as passed.
      static void endTest(Status status)
      Ends the current test level and sets the specified status for the test.
      static java.lang.String generateReport()
      Generates the LeanFT report.
      static ReportConfiguration getReportConfiguration()
      Returns the ReportConfiguration interface, which enables you to customize the LeanFT report behavior.
      static java.lang.String getReportDescription()
      Returns the LeanFT report description.
      static ReportLevel getReportLevel()
      Returns the report level used to generate the LeanFT report.
      static java.lang.String getReportTitle()
      Returns the LeanFT report title.
      static CaptureLevel getSnapshotCaptureLevel()
      Returns the snapshot capture level used to generate the LeanFT report.
      static Status getStatus()
      Returns the runtime status of the LeanFT report.
      static void init()
      Initializes the report with the default configuration, as defined in the report section of the leanft.properties file.
      static void init(ModifiableReportConfiguration configuration)
      Initializes the report with provided the report configuration.
      static void reportEvent(java.lang.String stepName, java.lang.String description)
      Adds a custom step to the LeanFT report with default status "Passed".
      static void reportEvent(java.lang.String stepName, java.lang.String description, Status status)
      Adds a custom step to the LeanFT report.
      static void reportEvent(java.lang.String stepName, java.lang.String description, Status status, java.lang.Exception ex, java.awt.image.RenderedImage image)
      Adds a custom step to the LeanFT report including the provided exception and image object.
      static void reportEvent(java.lang.String stepName, java.lang.String description, Status status, java.awt.image.RenderedImage image)
      Adds a custom step to the LeanFT report including the provided image object.
      static void reportEvent(java.lang.String stepName, java.lang.String description, Status status, java.lang.String imagePath)
      Adds a custom step to the LeanFT report including the image from the specified path.
      static void reportEvent(java.lang.String stepName, java.lang.String description, Status status, java.lang.Throwable e)
      Adds a custom step to the LeanFT report including the provided exception.
      static void reportEvent(java.lang.String stepName, java.lang.String description, Status status, java.lang.Throwable e, java.lang.String imagePath)
      Adds a custom step to the LeanFT report including exception details and the image from the specified path.
      static void reportEvent(java.lang.String stepName, ReportAdditionalInfo reportAdditionalInfo)

      Adds a custom step to the LeanFT report including the information about the step as a ReportAdditionalInfo object.

      static void reportRuntimeError(java.lang.Throwable throwable)
      Adds a runtime error node to the report with the supplied Throwable object as the reason.
      static void reportVerification(Status status, VerificationData verificationData)
      Adds a custom verification step to the LeanFT report.
      static void setReportDescription(java.lang.String reportDescription)
      Sets the LeanFT report description.
      static void setReportLevel(ReportLevel reportLevel)
      Sets the report level used to generate the LeanFT report.
      static void setReportTitle(java.lang.String reportTitle)
      Sets the report title.
      static void setSnapshotCaptureLevel(CaptureLevel snapshotCaptureLevel)
      Sets the snapshot capture level used to generate the LeanFT report.
      static void startReportingContext(java.lang.String contextName)
      Starts a named section in the LeanFT report.
      static void startReportingContext(java.lang.String contextName, java.lang.String contextDescription)
      Starts a named section in the LeanFT report.
      static void startReportingContext(java.lang.String contextName, ReportContextInfo reportContextInfo)
      Starts a named section in the LeanFT report.
      static void startReportingContext(java.lang.String contextName, java.lang.String contextDescription, Map<String, Object> data)
      Starts a named section in the LeanFT report.
      static void startTest(java.lang.String testName)
      Starts a new test node in the LeanFT report test flow tree.
      static void startTest(java.lang.String testName, java.lang.String testDescription)
      Starts a new test node in the LeanFT report test flow tree.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Reporter

        public Reporter()
    • Method Detail

      • getReportConfiguration

        public static ReportConfiguration getReportConfiguration()
        Returns the ReportConfiguration interface, which enables you to customize the LeanFT report behavior.
        Returns:
        Report Configuration.
      • reportEvent

        public static void reportEvent(java.lang.String stepName,
                                       java.lang.String description,
                                       Status status)
                                throws ReportException
        Adds a custom step to the LeanFT report.
        Parameters:
        stepName - the name of the reported step. This name is the label of the step node in the report.
        description - the description of the reported step. The description is displayed in the Details pane of the report.
        status - the Status for the step.
        Throws:
        ReportException - if error occurs in the report
      • reportEvent

        public static void reportEvent(java.lang.String stepName,
                                       java.lang.String description,
                                       Status status,
                                       java.lang.String imagePath)
                                throws ReportException
        Adds a custom step to the LeanFT report including the image from the specified path.
        Parameters:
        stepName - the name of the reported step. This name is the label of the step node in the report.
        description - the description of the reported step. The description is displayed in the Details pane of the report.
        status - the Status for the step.
        imagePath - the full path of the image to display for the step. Supported image types: BMP, GIF, JPEG, PNG, TIFF
        Throws:
        ReportException - if error occurs in the report
      • reportEvent

        public static void reportEvent(java.lang.String stepName,
                                       java.lang.String description,
                                       Status status,
                                       java.lang.Throwable e)
                                throws ReportException
        Adds a custom step to the LeanFT report including the provided exception.
        Parameters:
        stepName - the name of the reported step. This name is the label of the step node in the report.
        description - the description of the reported step. The description is displayed in the Details pane of the report.
        status - the Status for the step.
        e - the error that occurred.
        Throws:
        ReportException - if error occurs in the report
      • reportEvent

        public static void reportEvent(java.lang.String stepName,
                                       java.lang.String description,
                                       Status status,
                                       java.lang.Throwable e,
                                       java.lang.String imagePath)
                                throws ReportException
        Adds a custom step to the LeanFT report including exception details and the image from the specified path.
        Parameters:
        stepName - the name of the reported step. This name is the label of the step node in the report.
        description - the description of the reported step. The description is displayed in the Details pane of the report.
        status - the Status for the step.
        e - the error that occurred.
        imagePath - the full path of the image to display for the step. Supported image types: BMP, GIF, JPEG, PNG, TIFF
        Throws:
        ReportException - if error occurs in the report
      • reportEvent

        public static void reportEvent(java.lang.String stepName,
                                       java.lang.String description)
                                throws ReportException
        Adds a custom step to the LeanFT report with default status "Passed".
        Parameters:
        stepName - the name of the reported step. This name is the label of the step node in the report.
        description - the description of the reported step. The description is displayed in the Details pane of the report.
        Throws:
        ReportException - if error occurs in the report
      • reportEvent

        public static void reportEvent(java.lang.String stepName,
                                       java.lang.String description,
                                       Status status,
                                       java.awt.image.RenderedImage image)
                                throws ReportException
        Adds a custom step to the LeanFT report including the provided image object.
        Parameters:
        stepName - the name of the reported step. This name is the label of the step node in the report.
        description - the description of the reported step. The description is displayed in the Details pane of the report.
        status - the Status for the step.
        image - the RenderedImage object to use for the step.
        Throws:
        ReportException - if error occurs in the report
      • reportEvent

        public static void reportEvent(java.lang.String stepName,
                                       java.lang.String description,
                                       Status status,
                                       java.lang.Exception ex,
                                       java.awt.image.RenderedImage image)
                                throws ReportException
        Adds a custom step to the LeanFT report including the provided exception and image object.
        Parameters:
        stepName - the name of the reported step. This name is the label of the step node in the report.
        description - the description of the reported step. The description is displayed in the Details pane of the report.
        status - the Status for the step.
        ex - the exception that occurred.
        image - the RenderedImage object to use for the step.
        Throws:
        ReportException - if error occurs in the report
      • reportEvent

        public static void reportEvent(java.lang.String stepName,
        				ReportAdditionalInfo reportAdditionalInfo)
        			throws ReportException
        Adds a custom step to the LeanFT report including the information about the step as a ReportAdditionalInfo object.
        Parameters:
        stepName - the name of the reported step. This name is the label of the step node in the report.
        reportAdditionalInfo - a ReportAdditionalInfo object that contains the information to describe the event.
        Throws:
        ReportException - if error occurs in the report
      • addRunInformation

        public static void addRunInformation(java.lang.String fieldName,
                                             java.lang.String fieldValue)
        Adds a custom entry to the top section of the LeanFT report.
        Parameters:
        fieldName - the entry name.
        fieldValue - the entry value
      • startReportingContext

        public static void startReportingContext(java.lang.String contextName)
                                          throws ReportException
        Starts a named section in the LeanFT report.
        Parameters:
        contextName - the section name.
        Throws:
        ReportException - if error occurs in the report
      • startReportingContext

        public static void startReportingContext(java.lang.String contextName,
                                                 java.lang.String contextDescription)
                                          throws ReportException
        Starts a named section in the LeanFT report.
        Parameters:
        contextName - the section name.
        contextDescription - the section description.
        Throws:
        ReportException - if error occurs in the report
      • startReportingContext

        public static void startReportingContext(java.lang.String contextName,
        					ReportContextInfo reportContextInfo)
        				throws ReportException
        Starts a named section in the LeanFT report.
        Parameters:
        contextName - the section name.
        reportContextInfo - a ReportContextInfo object which contains the information to describe the section.
        Throws:
        ReportException - if error occurs in the report
      • startReportingContext

        public static void startReportingContext(java.lang.String contextName,
                                                 java.lang.String contextDescription, 
                                                 Map<String, Object> data)
        				throws ReportException
        Starts a named section in the LeanFT report.
        Parameters:
        contextName - the section name.
        contextDescription - the section description.
        data - the map containing additional custom information.
        Throws:
        ReportException - if error occurs in the report
      • endReportingContext

        public static void endReportingContext()
                                        throws ReportException
        Ends the section in the LeanFT report.
        Throws:
        ReportException - if error occurs in the report
      • startTest

        public static void startTest(java.lang.String testName)
                              throws ReportException
        Starts a new test node in the LeanFT report test flow tree. Required only when using Reporter in a class that does not inherit from UnitTestBase.
        Parameters:
        testName - name of the test.
        Throws:
        ReportException - if error occurs in the report
      • startTest

        public static void startTest(java.lang.String testName,
                                     java.lang.String testDescription)
                              throws ReportException
        Starts a new test node in the LeanFT report test flow tree.
        Parameters:
        testName - the test name.
        testDescription - the test description.
        Throws:
        ReportException - if error occurs in the report
      • endTest

        public static void endTest()
                            throws ReportException
        Ends the current test level and sets the test status as passed.
        Throws:
        ReportException - if error occurs in the report
      • endTest

        public static void endTest(Status status)
                            throws ReportException
        Ends the current test level and sets the specified status for the test.
        Parameters:
        status - the Status for the current test.
        Throws:
        ReportException - if error occurs in the report
      • init

        public static void init()
                         throws ReportException
        Initializes the report with the default configuration, as defined in the report section of the leanft.properties file.
        Throws:
        ReportException - if error occurs in the report
      • generateReport

        public static java.lang.String generateReport()
                                               throws ReportException
        Generates the LeanFT report.
        Returns:
        the XML file path on which the LeanFT report is based.
        Throws:
        ReportException - if error occurs in the report
      • getReportDescription

        public static java.lang.String getReportDescription()
        Returns the LeanFT report description. The description appears directly below the title in the LeanFT report. By default, the description is empty.
        Returns:
        report the LeanFT report description.
      • setReportDescription

        public static void setReportDescription(java.lang.String reportDescription)
        Sets the LeanFT report description. The description appears directly below the title in the LeanFT report.
        Parameters:
        reportDescription - The description to use for the report.
      • getReportTitle

        public static java.lang.String getReportTitle()
        Returns the LeanFT report title. Default = Run Results.
        Returns:
        the LeanFT report title.
      • setReportTitle

        public static void setReportTitle(java.lang.String reportTitle)
        Sets the report title.
        Parameters:
        reportTitle - the report description to use.
      • getReportLevel

        public static ReportLevel getReportLevel()
        Returns the report level used to generate the LeanFT report.
        Returns:
        the ReportLevel.
      • setReportLevel

        public static void setReportLevel(ReportLevel reportLevel)
        Sets the report level used to generate the LeanFT report.
        Parameters:
        reportLevel - the report level to use. Possible values: ReportLevel
      • getSnapshotCaptureLevel

        public static CaptureLevel getSnapshotCaptureLevel()
        Returns the snapshot capture level used to generate the LeanFT report.
        Returns:
        the CaptureLevel.
      • setSnapshotCaptureLevel

        public static void setSnapshotCaptureLevel(CaptureLevel snapshotCaptureLevel)
        Sets the snapshot capture level used to generate the LeanFT report.
        Parameters:
        snapshotCaptureLevel - the CaptureLevel to use.
      • getStatus

        public static Status getStatus()
        Returns the runtime status of the LeanFT report.
        Returns:
        the Status.
      • reportVerification

        public static void reportVerification(Status status,
                                              VerificationData verificationData)
                                       throws ReportException
        Adds a custom verification step to the LeanFT report.
        Parameters:
        status - Specify if the verification was passed or not.
        verificationData - The report verification data.
        Throws:
        ReportException - if error occurs in the report
      • reportRuntimeError

        public static void reportRuntimeError(java.lang.Throwable throwable)
        Adds a runtime error node to the report with the supplied Throwable object as the reason. The report status will be set to failed.
        Parameters:
        throwable - the reason for the report failure.