com.hp.lft.report

Class Reporter

  • java.lang.Object
    • com.hp.lft.report.Reporter


  • public class Reporter
    extends java.lang.Object
    Accesses the UFT Developer 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 UFT Developer report.
      static void endReportingContext()
      Ends the section in the UFT Developer 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 UFT Developer report.
      static Status

      getCurrentExecutionContextStatus()

      Returns the status of the current execution context. The execution context is equivalent to any superior structure that contains operations (e.g.: test method, reporting context, etc.).
      static ReportConfiguration getReportConfiguration()
      Returns the ReportConfiguration interface, which enables you to customize the UFT Developer report behavior.
      static java.lang.String getReportDescription()
      Returns the UFT Developer report description.
      static ReportLevel getReportLevel()
      Returns the report level used to generate the UFT Developer report.
      static java.lang.String getReportTitle()
      Returns the UFT Developer report title.
      static CaptureLevel getSnapshotCaptureLevel()
      Returns the snapshot capture level used to generate the UFT Developer report.
      static Status getStatus()
      Returns the runtime status of the UFT Developer 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 UFT Developer report with default status "Passed".
      static void reportEvent(java.lang.String stepName, java.lang.String description, Status status)
      Adds a custom step to the UFT Developer 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 UFT Developer 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 UFT Developer 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 UFT Developer 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 UFT Developer 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 UFT Developer 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 UFT Developer 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 UFT Developer report.
      static void setReportDescription(java.lang.String reportDescription)
      Sets the UFT Developer report description.
      static void setReportLevel(ReportLevel reportLevel)
      Sets the report level used to generate the UFT Developer 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 UFT Developer report.
      static void startReportingContext(java.lang.String contextName)
      Starts a named section in the UFT Developer report.
      static void startReportingContext(java.lang.String contextName, java.lang.String contextDescription)
      Starts a named section in the UFT Developer report.
      static void startReportingContext(java.lang.String contextName, ReportContextInfo reportContextInfo)
      Starts a named section in the UFT Developer report.
      static void startReportingContext(java.lang.String contextName, java.lang.String contextDescription, Map<String, Object> data)
      Starts a named section in the UFT Developer report.
      static void startScreenRecording(java.lang.Boolean useCompression, java.lang.String outputPath)
      Starts screen recording.
      Supported on UFT Developer versions 15.0.1 and later
      static void startScreenRecording(java.lang.Boolean useCompression)
      Starts screen recording to the report folder.
      Supported on UFT Developer versions 15.0.1 and later
      static void startScreenRecording(java.lang.String outputPath)
      Starts screen recording of a time lapse video.
      Supported on UFT Developer versions 15.0.1 and later
      static void

      startScreenRecording()

      Starts screen recording of a time lapse video saved to the reporter folder.
      Supported on UFT Developer versions 15.0.1 and later
      static void startTest(java.lang.String testName)
      Starts a new test node in the UFT Developer report test flow tree.
      static void startTest(java.lang.String testName, java.lang.String testDescription)
      Starts a new test node in the UFT Developer report test flow tree.
      static void stopScreenRecording ()
      Stops screen recording.
      Supported on UFT Developer versions 15.0.1 and later
      • 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 UFT Developer 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 UFT Developer 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 UFT Developer 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 UFT Developer 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 UFT Developer 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 UFT Developer 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 UFT Developer 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 UFT Developer 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 UFT Developer 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 UFT Developer report.
        Parameters:
        fieldName - the entry name.
        fieldValue - the entry value
      • startScreenRecording

        Supported on UFT Developer versions 15.0.1 and later
        public static void startScreenRecording(java.lang.Boolean useCompression, java.lang.String outputPath)
        					throws ReportException
        Starts screen recording. A test cannot start multiple screen recordings in parallel. To stop the recording, use stopScreenRecording.
        Parameters:
        useCompression - Specifies whether to record the whole scene or present a time-lapse video. true. The recorded video represents a time lapse of the recorded scene. false. the full scene is recorded.
        outputPath - The target location for the recorded video. A link to the recording is added to the test results. If you enter a relative path, the path is relative to the report folder.
        Throws:
        ReportException - if error occurs in the report
      • startScreenRecording

        Supported on UFT Developer versions 15.0.1 and later
        public static void startScreenRecording(java.lang.Boolean useCompression)
        					throws ReportException
        Starts screen recording to the report folder. A test cannot start multiple screen recordings in parallel. To stop the recording, use stopScreenRecording.
        Parameters:
        useCompression - Specifies whether to record the whole scene or present a time-lapse video. true. The recorded video represents a time lapse of the recorded scene. false. the full scene is recorded.
        Throws:
        ReportException - if error occurs in the report
      • startScreenRecording

        Supported on UFT Developer versions 15.0.1 and later
        public static void startScreenRecording(java.lang.String outputPath)
        					throws ReportException
        Starts screen recording of a time lapse video. A test cannot start multiple screen recordings in parallel. To stop the recording, use stopScreenRecording.
        Parameters:
        outputPath - The target location for the recorded video. A link to the recording is added to the test results. If you enter a relative path, the path is relative to the report folder.
        Throws:
        ReportException - if error occurs in the report
      • startScreenRecording

        Supported on UFT Developer versions 15.0.1 and later
        public static void startScreenRecording()
        			throws ReportException
        Starts screen recording of a time lapse video saved to the reporter folder. A test cannot start multiple screen recordings in parallel. To stop the recording, use stopScreenRecording.
        Throws:
        ReportException - if error occurs in the report
      • stopScreenRecording

        Supported on UFT Developer versions 15.0.1 and later
        public static void stopScreenRecording()
        			throws ReportException
        Stops screen recording. A link to the recording is added to the report. To start the recording use startScreenRecording.
        Throws:
        ReportException - if error occurs in the report
      • startReportingContext

        public static void startReportingContext(java.lang.String contextName)
                                          throws ReportException
        Starts a named section in the UFT Developer 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 UFT Developer 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 UFT Developer 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 UFT Developer 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 UFT Developer 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 UFT Developer 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 UFT Developer 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 UFT Developer report.
        Returns:
        the XML file path on which the UFT Developer report is based.
        Throws:
        ReportException - if error occurs in the report
      • getCurrentExecutionContextStatus

        public static Status getCurrentExecutionContextStatus()

        Returns the status of the current execution context. The execution context is equivalent to any superior structure that contains operations (e.g.: test method, reporting context, etc.).

        Returns:

        The status of the current execution context as a Status object.

      • getReportDescription

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

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

        public static java.lang.String getReportTitle()
        Returns the UFT Developer report title. Default = Run Results.
        Returns:
        the UFT Developer 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 UFT Developer report.
        Returns:
        the ReportLevel.
      • setReportLevel

        public static void setReportLevel(ReportLevel reportLevel)
        Sets the report level used to generate the UFT Developer 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 UFT Developer report.
        Returns:
        the CaptureLevel.
      • setSnapshotCaptureLevel

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

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

        public static void reportVerification(Status status,
                                              VerificationData verificationData)
                                       throws ReportException
        Adds a custom verification step to the UFT Developer 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.