OpenText™ Functional Testing for Developers JavaScript SDK

Reporter

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 run results report.
Parameters:
Name Type Description
fieldName string The name of the entry.
fieldValue string The entry value.
Returns:
Type
void

endReportingContext() → {Promise.<void>}

Ends the section in the run results report.
Returns:
Type
Promise.<void>

endSpec(specDescriptionopt) → {void}

Ends the current spec level and optionally sets the status for the spec.
Parameters:
Name Type Attributes Description
specDescription Reporter.Status <optional>
The status for the current spec. Default = Passed.
Returns:
Type
void

generateReport() → {null|string}

Generates the run results report.
Returns:
the path to the run results report.
Type
null | string

getCurrentExecutionContextStatus() → {Promise}

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:
Type
Promise

getStatus() → {Reporter.Status}

Returns a promise containing the runtime status of the run results report.
Returns:
Promise containing the runtime status of the run results report.
Type
Reporter.Status

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

Adds a custom step to the run results report including exception details.
Parameters:
Name Type Description
stepName string The name of the reported step. This name is the label of the step node in the report.
description string The description of the reported step. The description is displayed in the Details pane of the report.
exception Error The exception that occurred.
Returns:
Type
void

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

Adds a custom step to the run results report including exception details and the Base64 image.
Parameters:
Name Type Description
stepName string The name of the reported step. This name is the label of the step node in the report.
description string The description of the reported step. The description is displayed in the Details pane of the report.
exception Error The exception that occurred.
image string The Base64 image to use for the step.
Returns:
Type
void

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

Adds a custom step to the run results report with default status "Passed".
Parameters:
Name Type Attributes Description
stepName string The name of the reported step. This name is the label of the step node in the report.
description string The description of the reported step. The description is displayed in the Details pane of the report.
status Reporter.Status <optional>
The status for the step.
Returns:
Type
void

reportEventWithAdditionalInfo(stepName, additionalInfo) → {void}

Adds a custom step to the run results report including information contained in the additionalInfo parameter
Parameters:
Name Type Description
stepName string The name of the reported step. This name is the label of the step node in the report.
additionalInfo object A property bag containing information about the step.
Properties
Name Type Attributes Description
description string <optional>
The verification description presented in the report file.
status Reporter.Status <optional>
The status of the step as a property of LFT.Reporter.Status
imagePath string <optional>
The path of the image file
error string <optional>
An error message
image string <optional>
An image as base64 string
startTime Date <optional>
When the step started for calculating the correct duration
data object <optional>
Additional custom data about the step as a JavaScript object
Returns:
Type
void

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

Adds a custom step to the run results report with default status "Passed" and an image.
Parameters:
Name Type Attributes Description
stepName string The name of the reported step. This name is the label of the step node in the report.
description string The description of the reported step. The description is displayed in the Details pane of the report.
status Reporter.Status <optional>
The status for the step.
image string The Base64 image to use for the step.
Returns:
Type
void

reportVerification(status, verificationData) → {void}

Adds a custom verification step to the run results report.
Parameters:
Name Type Description
status string The verification result status.
verificationData Reporter.VerificationData The report verification data.
Returns:
Type
void

setSnapshotCaptureLevel(snapshotCaptureLevel) → {void}

Sets the snapshot capture level used to generate the run results report.
Parameters:
Name Type Description
snapshotCaptureLevel number The CaptureLevel to use.
Returns:
Type
void

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

Starts a named section in the run results report.
Parameters:
Name Type Attributes Description
contextName string The section name.
contextDescription string <optional>
The section description. Default=blank.
additionalData object The key/value object containing additional custom information.
Returns:
Type
Promise.<void>

startReportingContextWithInfo(contextName, reportContextInfo) → {void}

Starts a named section in the run results report.
Parameters:
Name Type Description
contextName string The section name.
reportContextInfo object A property bag containing information about the reporting context.
Properties
Name Type Attributes Description
description string <optional>
The section description. Default=blank.
contextMode string <optional>
The mode of the reporting context as an LFT.Reporter.ReportContextMode enum value: Normal or Verification. Default value = Normal.
data object <optional>
Additional custom data about the reporting context as a JavaScript object.
Returns:
Type
void

startScreenRecording(useCompressionopt, outputPathopt) → {Promise.<void>}

Starts screen recording. A test cannot start multiple screen recordings in parallel. The recording file format is ".avi".
Parameters:
Name Type Attributes Description
useCompression boolean <optional>
if true (default) the recorded video represents a time lapse of the recorded scene, otherwise the full scene gets recorded
outputPath string <optional>
target location for the recorded video, in case of a relative path, the output can be found in the report folder, if you don't specify a folder, the recording is saved in the report folder
Returns:
Type
Promise.<void>

startSpec(specName, specDescription) → {void}

Starts a new spec level for the run results report.
Parameters:
Name Type Description
specName string The name of the spec, that is, the label of the spec node in the report.
specDescription string The spec description.
Returns:
Type
void

stopScreenRecording() → {Promise.<void>}

Stops screen recording.
Returns:
Type
Promise.<void>

Type Definitions

CaptureLevel

The possible levels for capturing snapshots for the report.
Type:
  • Object
Properties:
Name Type Description
All number Snapshots are captured for all test object operations.
OnError number TSnapshots are captured only for test object operations with errors.
Off number Snapshots are not captured.

ReportLevel

The possible levels for reporting events to the run results report.
Type:
  • Object
Properties:
Name Type Description
All string Report events on all levels.
Warning string Report only events with the status Warning or Error.
Error string Report only events with the status Error.
Off string Disable all report levels. A run results report is not created.

Status

The possible statuses of an event reported to the run results report.
Type:
  • Object
Properties:
Name Type Description
Passed string The event related to the node and all of its sub-nodes succeeded.
Failed string The event related to the node or to one of its sub-nodes failed.
Warning string The 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:
Name Type Description
data object A property bag containing possible data for the VerificationData object
Properties
Name Type Description
name string The name of the verification presented in the report file.
description string The verification description presented in the report file.
parameters string Array 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.
image string The Base64 verification image presented in the report file.