Reporter Class

Provides the means to report custom events, additional data, and configuration for the report.

 

Methods

addRunInformation(fieldName, fieldValue) → {void}

Adds a custom entry to the top section of the UFT Developer report.
Parameters:
NameTypeDescription
fieldNamestringThe name of the entry.
fieldValuestringThe entry value.
Returns:
Type
void

endReportingContext() → {Promise.<void>}

Ends the section in the UFT Developer report.
Returns:
Type
Promise.<void>

endSpec(specDescriptionopt) → {void}

Ends the current spec level and optionally sets the status for the spec.
Parameters:
NameTypeAttributesDescription
specDescriptionReporter.Status <optional>
The status for the current spec. Default = Passed.
Returns:
Type
void

generateReport() → {null|string}

Generates the UFT Developer report.
Returns:
the path to the UFT Developer report.
Type
null | string

getCurrentExecutionContextStatus() → {Promise.<void>}

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).
Returns:
Type
Promise.<void>

getStatus() → {Promise.<string>}

UFT Developer 2021 R1 and later

Returns the runtime status of the UFT Developer report.
Returns:

a promise that is fulfilled with a string representing the runtime status of the UFT Developer report.

Type
Promise.<string>
Possible values: "Passed", "Failed", "Warning".

getStatus() → {Reporter.Status}

UFT Developer 2021 and earlier

Returns the runtime status of the UFT Developer report.
Returns:
the runtime status of the UFT Developer report.
Type
Reporter.Status

reportErrorEvent(stepName, description, exception) → {void}

Adds a custom step to the UFT Developer report including exception details.
Parameters:
NameTypeDescription
stepNamestringThe name of the reported step. This name is the label of the step node in the report.
descriptionstringThe description of the reported step. The description is displayed in the Details pane of the report.
exceptionErrorThe exception that occurred.
Returns:
Type
void

reportErrorEventWithImage(stepName, description, exception, image) → {void}

Adds a custom step to the UFT Developer report including exception details and the Base64 image.
Parameters:
NameTypeDescription
stepNamestringThe name of the reported step. This name is the label of the step node in the report.
descriptionstringThe description of the reported step. The description is displayed in the Details pane of the report.
exceptionErrorThe exception that occurred.
imagestringThe Base64 image to use for the step.
Returns:
Type
void

reportEvent(stepName, description, statusopt) → {void}

Adds a custom step to the UFT Developer report with default status "Passed".
Parameters:
NameTypeAttributesDescription
stepNamestringThe name of the reported step. This name is the label of the step node in the report.
descriptionstringThe description of the reported step. The description is displayed in the Details pane of the report.
statusReporter.Status <optional>
The status for the step.
Returns:
Type
void

reportEventWithAdditionalInfo(stepName, additionalInfo) → {void}

Adds a custom step to the UFT Developer report including information contained in the additionalInfo parameter.
Parameters:
NameTypeAttributesDescription
stepNamestringThe name of the reported step. This name is the label of the step node in the report.
additionalInfoobject

A property bag containing information about the step.

Properties
NameTypeAttributesDescription
descriptionstring <optional>
The description of the reported step. The description is displayed in the Details pane of the report.
statusReporter.Status <optional>
The status for the step.
imagePathstring <optional>
The path of an image file to use for the step.
errorstring <optional>
An error message.
imagestring <optional>
The Base64 image to use for the step.
dataobject <optional>
A key/value object containing additional custom information about the step.
Returns:
Type
void

reportEventWithImage(stepName, description, statusopt, image) → {void}

Adds a custom step to the UFT Developer report with default status "Passed" and an image.
Parameters:
NameTypeAttributesDescription
stepNamestringThe name of the reported step. This name is the label of the step node in the report.
descriptionstringThe description of the reported step. The description is displayed in the Details pane of the report.
statusReporter.Status <optional>
The status for the step.
imagestringThe Base64 image to use for the step.
Returns:
Type
void

reportVerification(status, verificationData) → {void}

Adds a custom verification step to the UFT Developer report.
Parameters:
NameTypeDescription
statusstringThe verification result status.
verificationDataReporter.VerificationDataThe report verification data.
Returns:
Type
void

setSnapshotCaptureLevel(snapshotCaptureLevel) → {void}

Sets the snapshot capture level used to generate the UFT Developer report.
Parameters:
NameTypeDescription
snapshotCaptureLevelnumberThe CaptureLevel to use.
Returns:
Type
void

startReportingContext(contextName, contextDescriptionopt, additionalDataopt) → {Promise.<void>}

Starts a named section in the UFT Developer report.
Parameters:
NameTypeAttributesDescription
contextNamestringThe section name.
contextDescriptionstring <optional>
The section description. Default=blank.
additionalDataobject<optional>The key/value object containing additional custom information.
Returns:
Type
Promise.<void>

startReportingContextWithInfo(contextName, reportContextInfo) → {Promise.<void>}

Starts a named section in the UFT Developer report.
Parameters:
NameTypeDescription
contextNamestringThe section name.
reportContextInfoobject

A property bag containing information about the reporting context.

Properties
NameTypeAttributesDescription
descriptionstring <optional>
The section description.
Default=empty
contextModestring <optional>

The mode of the reporting context as an LFT.Reporter.ReportContextMode enum value: Normal or Verification.

Default=Normal

dataobject <optional>
Additional custom data about the reporting context as a JavaScript object.
Returns:
Type
Promise.<void>

startScreenRecording(useCompressionopt, outputPathopt) → {void}

Starts screen recording, saved as an .avi file. A test cannot start multiple screen recordings in parallel. To stop the recording, use stopScreenRecording.
Parameters:
NameTypeAttributesDescription
useCompression boolean <optional>

Specifies whether to record the whole scene or present a time-lapse video.

Possible values: 

  • true (default). The recorded video represents a time lapse of the recorded scene
  • false. the full scene is recorded
outputPath string <optional>

The target location for the recorded video. A link to the recording is added to the test results.

  • If you do not specify a path, the video is saved in the report folder.
  • If you enter a relative path, the path is relative to the report folder.
Returns:
Type
void

startSpec(specName, specDescription) → {void}

Starts a new spec level for the UFT Developer report.
Parameters:
NameTypeDescription
specNamestringThe name of the spec, that is, the label of the spec node in the report.
specDescriptionstringThe spec description.
Returns:
Type
void

stopScreenRecording() → {void}

Stops screen recording. A link to the recording is added to the test results.
To start the recording use startScreenRecording.
Returns:
Type
void

Type Definitions

CaptureLevel

The possible levels for capturing snapshots for the report.
Type:
  • Object
Properties:
NameTypeDescription
AllnumberSnapshots are captured for all test object operations.
OnErrornumberTSnapshots are captured only for test object operations with errors.
OffnumberSnapshots are not captured.

ReportLevel

The possible levels for reporting events to the UFT Developer report.
Type:
  • Object
Properties:
NameTypeDescription
AllstringReport events on all levels.
WarningstringReport only events with the status Warning or Error.
ErrorstringReport only events with the status Error.
OffstringDisable all report levels. A UFT Developer report is not created.

Status

The possible statuses of an event reported to the UFT Developer report.
Type:
  • Object
Properties:
NameTypeDescription
PassedstringThe event related to the node and all of its sub-nodes succeeded.
FailedstringThe event related to the node or to one of its sub-nodes failed.
WarningstringThe event related to the node or to one of its sub-nodes resulted in a warning.

VerificationData

Represents the data used to report a custom verification step.
Type:
  • Object
Properties:
NameTypeDescription
dataobjectA property bag containing possible data for the VerificationData object
Properties
NameTypeDescription
namestringThe name of the verification presented in the report file.
descriptionstringThe verification description presented in the report file.
parametersstringArray of property bags with name/value pairs, representing the parameters data used in the context of the custom verification step, presented in the report file.
imagestringThe Base64 verification image presented in the report file.