Class Reporter

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

public class Reporter extends Object
Accesses the run results report.
  • Constructor Details

    • Reporter

      public Reporter()
  • Method Details

    • getReportConfiguration

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

      public static void reportEvent(String stepName, String description, Status status) throws ReportException
      Adds a custom step to the 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(String stepName, String description, Status status, String imagePath) throws ReportException
      Adds a custom step to the 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(String stepName, String description, Status status, Throwable e) throws ReportException
      Adds a custom step to the 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(String stepName, String description, Status status, Throwable e, String imagePath) throws ReportException
      Adds a custom step to the 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(String stepName, String description) throws ReportException
      Adds a custom step to the 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(String stepName, String description, Status status, RenderedImage image) throws ReportException
      Adds a custom step to the 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(String stepName, String description, Status status, Exception ex, RenderedImage image) throws ReportException
      Adds a custom step to the 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(String stepName, ReportAdditionalInfo reportAdditionalInfo) throws ReportException
      Adds a custom step to the run results 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
    • addRunInformation

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

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

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

      public static void startReportingContext(String contextName, String contextDescription, Map<String,Object> data) throws ReportException
      Starts a named section in the 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
    • startReportingContext

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

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

      public static void startTest(String testName) throws ReportException
      Starts a new test node in the 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(String testName, String testDescription) throws ReportException
      Starts a new test node in the 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(ModifiableReportConfiguration configuration) throws ReportException
      Initializes the report with provided the report configuration.
      Parameters:
      configuration - the ModifiableReportConfiguration to use.
      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 String generateReport() throws ReportException
      Generates the report.
      Returns:
      the XML file path on which the report is based.
      Throws:
      ReportException - if error occurs in the report
    • getReportDescription

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

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

      public static String getReportTitle()
      Returns the run results report title. Default = Run Results.
      Returns:
      the report title.
    • setReportTitle

      public static void setReportTitle(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 report.
      Returns:
      the ReportLevel.
    • setReportLevel

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

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

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

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

      public static void startScreenRecording(boolean useCompression, String outputPath) throws ReportException
      Starts screen recording. The recording file format is ".avi".
      Parameters:
      useCompression - if true the recorded video represents a time lapse of the recorded scene, otherwise the full scene gets recorded
      outputPath - target location for the recorded video, in case of a relative path, the output can be found in the report folder
      Throws:
      ReportException
    • startScreenRecording

      public static void startScreenRecording(String outputPath) throws ReportException
      Starts screen recording. Compression is ON. The recording file format is ".avi".
      Parameters:
      outputPath - target location for the recorded video, in case of a relative path, the output can be found in the report folder
      Throws:
      ReportException
    • startScreenRecording

      public static void startScreenRecording(boolean useCompression) throws ReportException
      Starts a screen recording which will be saved to the report folder. The recording file format is ".avi".
      Parameters:
      useCompression - if true the recorded video represents a time lapse of the recorded scene, otherwise the full scene gets recorded
      Throws:
      ReportException
    • startScreenRecording

      public static void startScreenRecording() throws ReportException
      Starts a screen recording which will be saved to the report folder. Compression is ON. The recording file format is ".avi".
      Throws:
      ReportException
    • stopScreenRecording

      public static void stopScreenRecording() throws ReportException
      Stops screen recording.
      Throws:
      ReportException