QTP and Reporter Objects

Updated On Jul 8, 2014 by

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="http://draft.blogger.com/post-edit.g 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.

Welcome new readers: Download the Free eBook!

Ankur JainI 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 my Google+ page. 

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.

Share This:


  1. Jim

    Is it possible to have Reporter.ReportEvent added as a placeholder after each event so I can go back and populate the correct parameters inside of it?

  2. balu


    I would not like to see all the events “Done” in the test results window. I want to see only Pass or failed which are reported with statement Reporter.ReportEvent. Could any please help me with idea or code ?

    • Ankur Jain

      @balu: Did you check Reporter.Filter?

      • balu

        Yes Ankur,

        I tried Reporter.Filter with all the parameters. but i could not filter for the messages for only pass and fail in the QTP test results Report

      • Ankur Jain

        @Balu: Ok, looks like you need to customize your results file.

        Go to UFT(QTP) Documentation > HP Run Results Viewer Help > Run Results Viewer > Run Results Viewer Overview > Run Results XML File

        Please read it start to finish. This is all what you need.

      • balu

        Hi Ankur, thanks for the reply, i am using QTP 10 , So i couldn’t find the doc specified by you. I have read other articles on customizing the test results. So i came to understand that the file “results.xml” has to be modified based on my requirement.
        But what to modify in the “results.xml” is a big question.

        It would be of great help, if you could explain this on the blog. and also the documentation path in QTP 10.

      • Ankur Jain

        @balu: Sure we will try to come up with a post on this topic. For the time being, you can ask your question on QTP forums.

  3. Gitika


    I am looking out to customize the QTP report to make it more readable/understandable to the Functional guys executing the scripts.

    Any suggestions how can the same be done?

  4. Anonymous

    1. I am unable to identify a Calendar on a .ASPX page after I record the script and run it again to verify.
    The code that is captured in Expert view appears as shown below:
    Browser(“POLO Home”).Page(“Add Policy Standard”).Image(“Select a date from the”).Click 8,9

    Browser(“POLO Home”).Page(“Add Policy Standard”).WebEdit(“ctl00$SPWebPartManager1$g_9142″).Click 52,7

    2. Also, the user names that are picked from Active Directory do not get polpulated while playing the script, although this step was recoded.
    The code for this step appears as shown below:
    Browser(“POLO Home”).Page(“Add Policy Standard”).WebList(“ctl00$SPWebPartManager1$g_9144″).Click 5,5
    Browser(“POLO Home”).Page(“Add Policy Standard”).WebEdit(“upLevelDiv”).Click 99,10
    Browser(“POLO Home”).Page(“Add Policy Standard”).Check CheckPoint(“Add Policy Standard_4″)
    Could you please help in getting this resolved.
    Thanks in advance.

    • kumar

      just go to object identification and set the object as standard windows in listbox and click userdefine and create the calender option

  5. Shan

    Hello Guys – I have a question related to Reporter.ReportEvent

    Lets say I want to write to the same step, more than one row, how to do this?

    Thank you

  6. guna

    Can we report results in excel sheet in a systematic manner as steps failed or pssed

  7. KimHanh

    Hi, if dataTable have 4 record.
    certainly, when I run, it return 4 result. I write: If Reporter.RunStatus=micFail Then
    Reporter.ReportEvent micFail,”AAA”, “Error”
    End If
    -Step 1 is Done => Reporter.RunStatus=2
    -Step 2 is Done => Reporter.RunStatus=2
    -Step 3 is Failed
    -But Step 4 is Done
    Reporter.RunStatus=1 ?????
    I think, in step 4, if Done, Reporter.RunStatus=2
    How do I do Reporter.RunStatus=2 not=1.
    Thank a lot

  8. Priya

    I have a Qn :
    If the test fail & trace out in the test report;how I pass that
    particular through script.

  9. Anonymous

    Hi, What do I do if I want pass and fail in my test result report but not warnings??

  10. Anders


    I know how to make my own reports, but is it possible to change the build in QTP reports (the ‘ReportStepName’ and/or ‘Description’), that is generated automatically when an error/warning occurs?

    E.g. when I use ‘On Error Resume Next’ QTP, of course, is making a lot of error and warning reports. Is is then possible to ignore these reports, and replace them with my own?

    Hope someone have an answer!

    • kumar

      SwfWindow(“training”).SwfWindow(“Data Extraction”).SwfButton(“E_Save”).Click ‘//Clicks on Save button

      If SwfWindow(“training”).Dialog(“Add Data Extraction”).WinButton(“E_PopupOK”).Exist (2) then
      Reporter.ReportEvent micPass,”Data Extraction – Dataset Page”,” Data Extracion Created Sucessfully”
      Print “E_DataExt_Dataset – Work Item ID : 48286)—> PASS)”
      Reporter.ReportEvent micFail,”Data Extraction – Dataset Page”,”Not able to Create Data Extraction”
      Print “E_DataExt_Dataset – Work Item ID : 48286)—> FAIL)”
      end if
      SwfWindow(“training”).Dialog(“Add Data Extraction”).WinButton(“E_PopupOK”).Click ‘//Displayed popup message

      • Vouriganti

        In QC, i need results as below while running with UFT

        Start Test
        Start Action
        Start Transaction
        – Step Name, Status(Pass/Fail),Step Description,Expected, Actual

        End Transaction
        End Action
        End Test

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>