In this post, we'll see how to customize and manage the information in QTP Test Result file. Test Result is automaticaly generated after every test run.
Reporter Object is used for sending information/message to the QTP test results. Following are the method/properties we can use with ‘Reporter’..
• ReportEvent Method
• Filter Property
• ReportPath Property
• RunStatus Property
ReportEvent is commonly used method od Reporter and most of you must be already aware of this!
As the name suggest, it reports an event to the test results. Means, by using Reporter.ReportEvent, you can send information to QTP test result file.
Syntax:Reporter.ReportEvent EventStatus, ReportStepName, Details
As we can see above, ReportEvent takes 3 arguments. Let's discuss these briefly-
EventStatus: Status of the step i.e. Pass/Fail etc. It can be four types..
0 or micPass: Causes the status of this step to be passed and sends the specified message to the report.
1 or micFail: Causes the status of this step to be failed and sends the specified message to the report. When this step runs, the test fails.
2 or micDone: Sends a message to the report without affecting the pass/fail status of the test.
3 or micWarning: Sends a warning message to the report, but does not cause the test to stop running, and does not affect the pass/fail status of the test
ReportStepName: It is name of step. It can be any string value.
Details: It is also any string value. You should provide description of steps here.
Example of ReportEvent Method
The following examples use the ReportEvent method to report a failed step.
Reporter.ReportEvent 1, "Custom Step", "The user-defined step failed."
Reporter.ReportEvent micFail, "Custom Step", "The user-defined step failed."
You can leave last two arguments (ReportStepName and Details) blank as well but recommended.
Reporter.ReportEvent 1, "", ""
Reporter.ReportEvent micFail, "", ""
Okay friends! It was most important part of Reporter. Let's quickly discuss remaining three properties also.
Using Filter property, you can instruct QTP about what type of event to display in result.
Syntax:Reporter.Filter = Mode
What is the use of Filter property?
Filter is used if you dont want to display all types of events in QTP test result. For example you have 10 Reporter.ReportEvent statements in your test (5-
Pass and 5-fail). By default all 10 will be displayed in result. You can use Filter if you want to display only pass or only fail events in the result. One way to comment all unwanted type of Reporter statements, but what if you can do that by writing just one line in your code!
There can be four types of Filter modes..
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. No event will be displayed in result file.
Example of Filter Property:
Reporter.Filter = 2
Reporter.Filter = rfEnableErrorsOnly
It simply retrieves the folder path in which the current test's results are stored.
Do not use this property to attempt to set the results folder path. Means it is used for 'getting the path' not 'setting the path'.
Syntax:Path = Reporter.ReportPath
Example of ReportPath Property
Path = Reporter.ReportPath
Above example uses the ReportPath property to retrieve the folder in which the results are stored and displays the path in a message box.
It retrieves the run status at any particular point during the run session. For tests, it returns the status of current test during the test run.
Example of RunStatus Property
If Reporter.RunStatus = micFail Then
Msgbox "Run Status is fail. Exiting from Action iteration."
Above example uses the RunStatus property to retrieve the status of the run session at a specific point and exit the action if the test status is fail. If the test status is not fail, the test run continues.
In case of any queries/suggessions, please post your comments.
thanks for explanationReplyDelete
can u plz help me to ans these questions.
1)Why we import the data from excelsheet to datatable and using it as datatable parameter...while we can use the value directly from excel sheet using excel application model .
What is the advantage over using datatable input over excel input in our script?
2) How to log defect after executing a script in qtp ?
Exporting sheets to datatable have several benefits of its own, for example..
Its more convenient at the time if you have lots of columns in the datatable. By importing shhets to Datatable, you can refer column by its name (which is not feasible to do using Excel COM)
Hi, gud explanation,ReplyDelete
can u tell me how to wrap reporter.reportevent in a function .. so that it can be called and passed arguments whenever required in the script
Hi ,can i delete all temp files directly from temp folder in QTP?ReplyDelete
if i delete is there any problem to face while running the script?cause my QTP became very slow... pls help me...
This comment has been removed by the author.ReplyDelete
You can tell for instance if the understudies are rehearsing moves for self preservation or on the off chance that it is rivalry sort of preparing. Likewise you can see whether they are about youngster or grown-up preparing. taekwondo school in lees summit moReplyDelete
Nice information and bery useful for all of us.ReplyDelete
Great job for publishing such a beneficial web site. Your web log isn’t only useful but it is additionally really creative too please do keep sharing more blogs like this.ReplyDelete
IELTS Coaching in chennai
German Classes in Chennai
GRE Coaching Classes in Chennai
TOEFL Coaching in Chennai
spoken english classes in chennai | Communication training
Nice post. Thanks for sharing! I want people to know just how good this information is in your article. It’s interesting content and Great work. nice to read.ReplyDelete
selenium training in chennai
selenium training in chennai
selenium online training in chennai
selenium training in bangalore
selenium training in hyderabad
selenium training in coimbatore
selenium online training
Excellent Blog! I would Thanks for sharing this wonderful content.its very useful to us.I gained many unknown information, the way you have clearly explained is really fantastic.keep posting like this information.ReplyDelete
Full Stack Training in Chennai
Full Stack Course Chennai
Full Stack Training in Bangalore
Full Stack Course in Bangalore
Full Stack Training in Hyderabad
Full Stack Course in Hyderabad
Full Stack Training
Full Stack Course
Full Stack Online Training
Full Stack Online Course
Hello there, You’ve done an incredible job. I will certainly digg it and personally recommend to my friends.ReplyDelete
I am sure they’ll be benefited from this site
Azure Training in Chennai
Azure Training in Bangalore
Azure Training in Hyderabad
Azure Training in Pune
Azure Training | microsoft azure certification | Azure Online Training Course
Azure Online Training
Attractive, post. I just stumbled upon your weblog and wanted to say that I have liked browsing your blog posts.ReplyDelete
staffing company in chennai,
staffing companies in chennai,
best staffing companies in chennai,
best staffing company in chennai,
staffing services in chennai
one funnel away challenge
one funnel away challenge 2021
one funnel away challenge 2022
one funnel away challenge review
one funnel away
digital marketing course in chennai
digital marketing training in chennai