How to work with Reporter Object in QTP or UFT

How to work with Reporter Object in QTP or UFT?

This post talks about reporter utility object in UFT,reporter object in UFT,UFT Reporter Objects with Examples,how to use Reporter.ReportEvent,syntax for reporter object in UFT.

A reporter object in UFT responsible for storing information related to test outcome to the run result.Reporter Object in UFT supports various methods and properties that are used in runtime to showcase the results.A reporter Object can change the control of the flow depending on outcome.

Ads code goes here
So a Reporter Object is responsible for the following:
  • Report test status
  • Enable or disable reporting
  • Get the folder path from where the test is running.
  • Fetch the run status.
  • Report custom test result and update the run result
READ  Learn Object Repository in UFT in An Efficient and Fast Manner

Methods available in Reporter object in UFT:

  • ReportEvent() method
  • ReportNote() method
  • ReportHtmlEvent() method

Properties available in Reporter object in UFT:

  • Filter property
  • Run status property
  • Reportpath property

Details of ReportEvent() method:

ReportEvent() method accepts four parameters

  • EventStatus
  • stepName
  • stepDetails or stepDescription
  • pathToSaveTheScreenshot
The syntax of ReportEvent() method or syntax for reporter object in UFT:
Reporter.ReportEvent EventStatus, stepName, stepDetails,pathToSaveTheScreenshot

Now EventStatus can be of 2 types(Primarily) and can be expressed as a constant or a number.

micPassThe step is passes and sends a pass signal to the run result.
micFail1The step is failed and sends a pass signal to the run result.
micDone2The step is completed and sends a completion signal to the run result.
micWarning3The step is completed with a warning and sends a warning signal to the run result.

It accepts a String parameter and accepts the custom step name that the user wants to display in the run result.

stepDetails or stepDescription:

It also accepts a String parameter and accepts the custom step details that the user wants to display in the run result.


It also accepts a String parameter that specifies if the coder wants to save the screenshot where UFT will place the result.

The image format supported by UFT are as follows:

  • .bmp
  • .jpeg
  • .png
  • .gif

However, it is an optional parameter.It is also not a good practice to capture screenshot in every step. That process may end up accumulating lots of screenshots. This will also have a impact on space and reporting time. So it is best when we only take screenshot if a test failed.

READ  How To Convert JSON File To XML format In UFT in VBScript way

How to capture a screenshot and use in the Reporter.ReportEvent()?

Browser("Login").Page("Login").CaptureBitmap errorFile,True 'True will overwrite an existing file'
Reporter.ReportEvent 1,"login test","Check if the page has id field",errorFile

We can also write a method to do the same by passing the file name and object name.

so the reporting will be ..

syntax for reporter object in UFT
Reporter.reportEvent 1,"User can not see the image" ,"Test case failed due to unavailability of the image"


Reporter.reportEvent micPass,"User can not see the image" ,"Test case failed due to unavailability of the image"
Example of ReportEvent method or how to use Reporter.ReportEvent?
Option Explicit
Dim myVar,a,b
If(myVar=25) then
Reporter.ReportEvent micPass,"verify Addition","Calculator is working"
Reporter.ReportEvent micFail,"verify Addition","Calculator is not working"
End if

Below are the reporter utility object in UFT:

Reporter.RunStatus Object

Reporter.RunStatus object provides the insights of the status of the current test run.We can further control the execution based on the outcome of the Reporter.RunStatus value.

Example of Reporter.RunStatus/UFT Reporter Objects with Examples

If Reporter.RunStatus=micFail Then
End If

This code will Exit the current test if the test status is failed.

How we can change the Reporter.RunStatus from code ?

From our code we can use the following code to change the status of the Reporter.RunStatus.

How to change the the mode of the test?

To change the mode of the test we need to use Reporter.Filter property.

The code will be:

How to get the current mode of the test run?

To get the current mode of the test run, we can use the following code.

msgbox Reporter.FilterProperty

UFT provides the following modes for the use of Filter property.

rfEnableAllIt is the default mode that displays all elements in the run result.
rfEnableErrorsAndWarnings1It filters out all other modes and displays only Errors and warnings.
rfEnableErrorsOnly2Displays only fails on the run result
rfDisableAll3Displays no events in the run result.
READ  How To Work With Automation Object Model In UFT?


What if you are using Reporter object on Adobe Flex then reporter object may fail intermittently or if you want to track the exact line of failure than you can override the ReporterEvent.

Can we use ReporterEvent in Keyword view or how to use Reporter.ReportEvent in keyword view?

Yes,we can use ReporterEvent() method in keyword view.Here is the navigation:

  • Select the desired step and choose Insert -> Step -> Report or right-click a step and choose Insert Step -> Report.

Reporter.ReportHtmlEvent() method

Reporter.ReportHtmlEvent() method is very similar to Reporter.ReportEvent(how to use Reporter.ReportEvent) with an exception that here we can insert custom HTML element to beatify the run result. It is a nice feature to customize the traditional reporting.

Reporter.ReportHTMLEvent micDone, "<b><i><font face='Arial' color='black'>Test ReportHTMLEvent</font></i></b>", "<b><font face='Arial bold' color='green'>Reporting Some Text with Color</font></b>"

Reporter.ReportNote() method

This method enables us to send a special to note to the run result that will be visible in the executive summary Note section.It is only visible if the root node is selected.

How to control Reporter object via code?

Reporter object in UFT can be controlled by code. Here is how-Joe has mentioned.

  • Enter the following code in the Expert View of your tests:
Set oEventDesc = CreateObject("Scripting.Dictionary")
oEventDesc("ViewType") = "Sell.Explorer.2"
oEventDesc("Status") = micPass
oEventDesc("EnableFilter") = False
oEventDesc("NodeName") = "My Blog"
oEventDesc("StepHtmlInfo") = "<a href='>TechTravelHub</a>"
newEventContext = Reporter.LogEvent ("Replay",oEventDesc,Reporter.GetContext)
  • Run your test and look at the HP Run Results Viewer.

This is how to use Reporter.ReportEvent in UFT.

Share and Enjoy !

23 thoughts on “How to work with Reporter Object in QTP or UFT”

  1. You can certainly see your enthusiasm in the work you write. The world hopes for even more passionate writers like you who are not afraid to say how they believe. Always go after your heart.

  2. After I initially commented I appear to have clicked the -Notify me when new comments are added- checkbox and now whenever a comment is added I recieve 4 emails with the exact same comment. Is there an easy method you can remove me from that service? Appreciate it!

  3. Spot on with this write-up, I honestly believe this amazing site needs much more attention. I’ll probably be returning to read through more, thanks for the advice!

  4. An impressive share! I have just forwarded this onto a friend who has been conducting a little research on this. And he actually ordered me lunch due to the fact that I found it for him… lol. So let me reword this…. Thanks for the meal!! But yeah, thanx for spending some time to talk about this subject here on your website.

  5. IsaiahCanatella12179

    Excellent blog you’ve got here.. It’s hard to find quality writing like yours these days. I honestly appreciate people like you! Take care!!

  6. It’s hard to find well-informed people in this particular topic, but you seem like you know what you’re talking about! Thanks

  7. We bought a recliner it’s nice affordable but after about 2 wks we realized that there is not enough cushion in the arms which makes it uncomfortable

  8. Pingback: Google

  9. I would like to thank you for the efforts you’ve put in writing this blog. I really hope to check out the same high-grade content by you in the future as well. In truth, your creative writing abilities has encouraged me to get my own, personal blog now 😉

  10. Greetings, I believe your site could possibly be having web browser compatibility issues. Whenever I look at your web site in Safari, it looks fine however, if opening in Internet Explorer, it has some overlapping issues. I just wanted to provide you with a quick heads up! Besides that, fantastic blog!

  11. Very good information. Lucky me I discovered your blog by chance (stumbleupon). I’ve saved as a favorite for later!

  12. I’m more than happy to discover this web site. I need to to thank you for ones time for this fantastic read!! I definitely liked every part of it and I have you book marked to look at new information on your blog.

  13. jonathoncottrell

    Thank you for the auspicious writeup. It in fact was a amusement account
    it. Look advanced to far added agreeable from you!
    By the way, how can we communicate?

  14. If you wish for to grow your know-how only keep visiting this website and
    be updated with the hottest news posted here.

  15. It is truly a nice and helpful piece of information. I’m happy that you shared this helpful info with us.
    Please keep us up to date like this. Thanks for sharing.

  16. Pingback: Google

  17. Pingback: Google

  18. Hey, thanks for a great post, it seems everyone these days is trying to make a little extra on the side but it is so hard to find really good blogs like yours. I’ve also been following this guy for a while and have had some success as a begginer using some of his methods. Maybe some of your readers might find it usefull too.

  19. Pingback: Google

  20. Pingback: Google

  21. Pingback: Google

  22. Pingback: Google

Leave a Comment

Your email address will not be published. Required fields are marked *