Package com.hp.lft.report
Class Reporter
java.lang.Object
com.hp.lft.report.Reporter
Accesses the run results report.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddRunInformation(String fieldName, String fieldValue) Adds a custom entry to the top section of the report.static voidEnds the section in the report.static voidendTest()Ends the current test level and sets the test status as passed.static voidEnds the current test level and sets the specified status for the test.static StringGenerates the report.static StatusReturns the status of the current execution context.static ReportConfigurationReturns theReportConfigurationinterface, which enables you to customize the report behavior.static StringReturns the description of the run results report.static ReportLevelReturns the report level used to generate the report.static StringReturns the run results report title.static CaptureLevelReturns the snapshot capture level used to generate the report.static StatusReturns the runtime status of the report.static voidinit()Initializes the report with the default configuration, as defined in the report section of the leanft.properties file.static voidinit(ModifiableReportConfiguration configuration) Initializes the report with provided the report configuration.static voidreportEvent(String stepName, ReportAdditionalInfo reportAdditionalInfo) Adds a custom step to the run results report including the information about the step as aReportAdditionalInfoobject.static voidreportEvent(String stepName, String description) Adds a custom step to the report with default status "Passed".static voidreportEvent(String stepName, String description, Status status) Adds a custom step to the report.static voidreportEvent(String stepName, String description, Status status, RenderedImage image) Adds a custom step to the report including the provided image object.static voidreportEvent(String stepName, String description, Status status, Exception ex, RenderedImage image) Adds a custom step to the report including the provided exception and image object.static voidreportEvent(String stepName, String description, Status status, String imagePath) Adds a custom step to the report including the image from the specified path.static voidreportEvent(String stepName, String description, Status status, Throwable e) Adds a custom step to the report including the provided exception.static voidAdds a custom step to the report including exception details and the image from the specified path.static voidreportRuntimeError(Throwable throwable) Adds a runtime error node to the report with the supplied Throwable object as the reason.static voidreportVerification(Status status, VerificationData verificationData) Adds a custom verification step to the report.static voidsetReportDescription(String reportDescription) Sets the report description.static voidsetReportLevel(ReportLevel reportLevel) Sets the report level used to generate the report.static voidsetReportTitle(String reportTitle) Sets the report title.static voidsetSnapshotCaptureLevel(CaptureLevel snapshotCaptureLevel) Sets the snapshot capture level used to generate the report.static voidstartReportingContext(String contextName) Starts a named section in the report.static voidstartReportingContext(String contextName, ReportContextInfo reportContextInfo) Starts a named section in the report.static voidstartReportingContext(String contextName, String contextDescription) Starts a named section in the report.static voidStarts a named section in the report.static voidStarts a screen recording which will be saved to the report folder.static voidstartScreenRecording(boolean useCompression) Starts a screen recording which will be saved to the report folder.static voidstartScreenRecording(boolean useCompression, String outputPath) Starts screen recording.static voidstartScreenRecording(String outputPath) Starts screen recording.static voidStarts a new test node in the report test flow tree.static voidStarts a new test node in the report test flow tree.static voidStops screen recording.
-
Constructor Details
-
Reporter
public Reporter()
-
-
Method Details
-
getReportConfiguration
Returns theReportConfigurationinterface, 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- theStatusfor 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- theStatusfor 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- theStatusfor 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- theStatusfor 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
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- theStatusfor 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- theStatusfor 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 aReportAdditionalInfoobject.- Parameters:
stepName- the name of the reported step. This name is the label of the step node in the report.reportAdditionalInfo- aReportAdditionalInfoobject that contains the information to describe the event- Throws:
ReportException
-
addRunInformation
Adds a custom entry to the top section of the report.- Parameters:
fieldName- the entry name.fieldValue- the entry value
-
startReportingContext
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 ReportExceptionStarts 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-ReportContextInfoobject which contains the information to describe the section.- Throws:
ReportException- if error occurs in the report
-
endReportingContext
Ends the section in the report.- Throws:
ReportException- if error occurs in the report
-
startTest
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
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
Ends the current test level and sets the test status as passed.- Throws:
ReportException- if error occurs in the report
-
endTest
Ends the current test level and sets the specified status for the test.- Parameters:
status- theStatusfor the current test.- Throws:
ReportException- if error occurs in the report
-
init
Initializes the report with provided the report configuration.- Parameters:
configuration- theModifiableReportConfigurationto use.- Throws:
ReportException- if error occurs in the report
-
init
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
Generates the report.- Returns:
- the XML file path on which the report is based.
- Throws:
ReportException- if error occurs in the report
-
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
Sets the report description. The description appears directly below the title in the report.- Parameters:
reportDescription- The description to use for the report.
-
getReportTitle
Returns the run results report title. Default = Run Results.- Returns:
- the report title.
-
setReportTitle
Sets the report title.- Parameters:
reportTitle- the report description to use.
-
getReportLevel
Returns the report level used to generate the report.- Returns:
- the
ReportLevel.
-
setReportLevel
Sets the report level used to generate the report.- Parameters:
reportLevel- the report level to use. Possible values:ReportLevel
-
getSnapshotCaptureLevel
Returns the snapshot capture level used to generate the report.- Returns:
- the
CaptureLevel.
-
setSnapshotCaptureLevel
Sets the snapshot capture level used to generate the report.- Parameters:
snapshotCaptureLevel- theCaptureLevelto use.
-
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
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
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
Statusobject.
-
startScreenRecording
public static void startScreenRecording(boolean useCompression, String outputPath) throws ReportException Starts screen recording. The recording file format is ".avi".- Parameters:
useCompression- iftruethe recorded video represents a time lapse of the recorded scene, otherwise the full scene gets recordedoutputPath- target location for the recorded video, in case of a relative path, the output can be found in the report folder- Throws:
ReportException
-
startScreenRecording
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
Starts a screen recording which will be saved to the report folder. The recording file format is ".avi".- Parameters:
useCompression- iftruethe recorded video represents a time lapse of the recorded scene, otherwise the full scene gets recorded- Throws:
ReportException
-
startScreenRecording
Starts a screen recording which will be saved to the report folder. Compression is ON. The recording file format is ".avi".- Throws:
ReportException
-
stopScreenRecording
Stops screen recording.- Throws:
ReportException
-