Reporter Object is used for sending information to the test results. With the help of this object you can:

  • >Report the status of test results (like pass, fail, warning)
  • >Enable/Disable reporting of step(s) following the statement.
  • >Retrieve the folder path in which the current test’s results are stored.
  • >Retrieve the run status at the current point of the run session.

There are some very important methods and properties associated with it.

ReporterEvent Method:

I think this is a very common method used with Reporter object. I am sure even if you have worked on QTP for a relatively short period, you would have come across this.
Its syntax:

Reporter.ReportEvent EventStatus, ReportStepName, Details

where EventStatus can be:
0 or micPass: If this step runs test passes which is shown in test report.

1 or micFail: If this step runs test fails which is shown in test report.

2 or micDone: Used to send message to the test report and does not affect status of test.

3 or micWarning: Again, used to send warning message to the test report and does not affect status of test.
ReportStepName is name of step
Details are the user defined details for the given step.
For Example:

Reporter.ReportEvent micPass, "Login Authorization", "The user-defined step passed."

Filter property

I have mentioned this on my other post Some Useful Tips with QTP but would like to mention it again here since I get a lot of questions on this.
There can be situations where you don’t want the full status displayed on the test report. This property can be used to selectively filter the status of your tests.
Its syntax:

Reporter.Filter = NewMode

where NewMode can be:

0 or rfEnableAll: This is the default mode. All reported events are displayed in the Test Results.

1 or rfEnableErrorsAndWarnings: Only those events with a warning or fail status are displayed in the Test Results.

2 or rfEnableErrorsOnly: Only those events with a fail status are displayed in the Test Results.

3 or rfDisableAll: All events in the Test Results are disabled.

ReportPath Property

This is used to get the path in which current test results are stored.
Its syntax:

<a href=" blogID=37212701&postID=8409054789915956544" name="wp1519582"></a>
Path_of_Results = Reporter.ReportPath

RunStatus Property

This is used to get the current status of the run session
Its syntax:


For Example:

if Reporter.RunStatus = 0 then flag=1;

If you want to keep track of further articles on QTP. I recommend you to subscribe via RSS Feed. You can also subscribe by Email and have new QTP articles sent directly to your inbox.

Please use QTP forum for posting QTP questions.
Ankur Jain

Welcome new readers: Download the Free eBook!

I am Ankur Jain, the owner of LearnQTP and founder of a software organization. This site is run, maintained and updated by me and my team. Feel free to take a look around, you may want to start with What is QTP? 

You can connect with me on twitter @ajonit. 

Please enter your first name and email address below to instantly download the eBook on Optimizing QTP Scripts. In future, we will make sure you get new tips & tricks on QTP delivered direct to your email box.

Please check your email and confirm free subscription!

Share This