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 void
addRunInformation
(String fieldName, String fieldValue) Adds a custom entry to the top section of the report.static void
Ends the section in the report.static void
endTest()
Ends the current test level and sets the test status as passed.static void
Ends the current test level and sets the specified status for the test.static String
Generates the report.static Status
Returns the status of the current execution context.static ReportConfiguration
Returns theReportConfiguration
interface, which enables you to customize the report behavior.static String
Returns the description of the run results report.static ReportLevel
Returns the report level used to generate the report.static String
Returns the run results report title.static CaptureLevel
Returns the snapshot capture level used to generate the report.static Status
Returns the runtime status of the 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
(String stepName, ReportAdditionalInfo reportAdditionalInfo) Adds a custom step to the run results report including the information about the step as aReportAdditionalInfo
object.static void
reportEvent
(String stepName, String description) Adds a custom step to the report with default status "Passed".static void
reportEvent
(String stepName, String description, Status status) Adds a custom step to the report.static void
reportEvent
(String stepName, String description, Status status, RenderedImage image) Adds a custom step to the report including the provided image object.static void
reportEvent
(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 void
reportEvent
(String stepName, String description, Status status, String imagePath) Adds a custom step to the report including the image from the specified path.static void
reportEvent
(String stepName, String description, Status status, Throwable e) Adds a custom step to the report including the provided exception.static void
Adds a custom step to the report including exception details and the image from the specified path.static void
reportRuntimeError
(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 report.static void
setReportDescription
(String reportDescription) Sets the report description.static void
setReportLevel
(ReportLevel reportLevel) Sets the report level used to generate the report.static void
setReportTitle
(String reportTitle) Sets the report title.static void
setSnapshotCaptureLevel
(CaptureLevel snapshotCaptureLevel) Sets the snapshot capture level used to generate the report.static void
startReportingContext
(String contextName) Starts a named section in the report.static void
startReportingContext
(String contextName, ReportContextInfo reportContextInfo) Starts a named section in the report.static void
startReportingContext
(String contextName, String contextDescription) Starts a named section in the report.static void
Starts a named section in the report.static void
Starts a screen recording which will be saved to the report folder.static void
startScreenRecording
(boolean useCompression) Starts a screen recording which will be saved to the report folder.static void
startScreenRecording
(boolean useCompression, String outputPath) Starts screen recording.static void
startScreenRecording
(String outputPath) Starts screen recording.static void
Starts a new test node in the report test flow tree.static void
Starts a new test node in the report test flow tree.static void
Stops screen recording.
-
Constructor Details
-
Reporter
public Reporter()
-
-
Method Details
-
getReportConfiguration
Returns theReportConfiguration
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
- theStatus
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
- theStatus
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
- theStatus
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
- theStatus
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
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
- theStatus
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
- theStatus
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 aReportAdditionalInfo
object.- Parameters:
stepName
- the name of the reported step. This name is the label of the step node in the report.reportAdditionalInfo
- aReportAdditionalInfo
object 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
-ReportContextInfo
object 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
- theStatus
for the current test.- Throws:
ReportException
- if error occurs in the report
-
init
Initializes the report with provided the report configuration.- Parameters:
configuration
- theModifiableReportConfiguration
to 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
- theCaptureLevel
to 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
Status
object.
-
startScreenRecording
public static void startScreenRecording(boolean useCompression, String outputPath) throws ReportException Starts screen recording. The recording file format is ".avi".- Parameters:
useCompression
- iftrue
the 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
- iftrue
the 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
-