UFT Reporter Object Methods that You Don’t Know

The Reporter object in UFT is used for sending information to the default result report in UFT.

UFT Reporter Object Methods

In this article, I will be discussing the following methods.
 
It reports an event to the run results. I have already written a detailed post on it. Please refer to the post Reporter.Event in UFT/QTP
 

ReportHtmlEvent in UFT

It also reports an event to the run results like ReportEvent.The only difference is that with the help of  ReportHtmlEvent you can also embed HTML tags in the customized reporting to beautify the reporting.

If you run a Test with the above reporting statement it will look like the following UFT HTML report.Reporter Event in UFT , Reporter Object in UFT

In the result viewer, the same would like the following snapshot.

Reporter-Event-UFT-06234

ReportNote in UFT

It adds a note to the run results. The note would be displayed in the Executive Summary Notes section of the Result Details pane when the root node is selected in the run results tree.

*Note: Don’t try to set the results folder path using this property as it is only meant to get the path of the current test result folder.

RunStatus in UFT

This is used to retrieve the current status of the run session.

The numerical value of status is as follows.

  • 0 = Pass
  • 1 = Fail
  • 2 = Done
  • 3 = Warning

*Note: The default status of a Test is 2 i.e Done. A Pass event takes precedence over a Done event. A Warning event takes precedence over a Pass event and a Fail event takes precedence over all the events.

Reporter Filter in UFT

The filter property is used to retrieve or set the current mode for displaying events in the run results.

For example, you can only include the event with a warning or fail status in the Run Results.

Syntax:

Reporter.Filter = NewMode
The following are the valid values for mode

Mode Description
0 or rfEnableAll Default. All reported events will be displayed in the Run Results.
or rfEnableErrorsAndWarnings Only an event with a warning or fail status will be displayed in the Run Results.
2 or rfEnableErrorsOnly Only events with a fail status will be displayed in the Run Results.
or rfDisableAll No events are displayed in the Run Results.

Example:
Suppressing Pass events in the Run result. Only events with a warning or fail status will be displayed in the Run Results.

If we run the above code in UFT the Run Result will be as follows:

Reporter Event UFT

You can also retrieve the value of the applied reporter filter at runtime using Reporter.Filter statement.

Reporter-Event-Filter-Uft

Recommended Posts

Leave a Reply