Reporter Object
As the name itself indicates Reporter Object reports test results at the end of running the test.
The method of Reporter Object is ReportEvent
Reporter.ReportEvent StatusOfTest, TypeOfMessaege, Details
Example:
Reporter.ReportEvent micPass, "Alert", " The test performed here has succeed"
Reporter.ReportEvent micFail, "Failure", " The test performed here has succeed"
Reporter.ReportEvent micDone, "Done", " The test performed here has succeed"
Reporter.ReportEvent micWarning, "Warning", " The test performed here has succeed"
The Status of Test can be
micPass
micFail
micDone
micWarning
micInfo
micGeneral
micGeneral is also considered as micDone
Apart from these, any junk text entered in StatusOfTest is considered as micPass.
Note that, mic stands for Mercury Interactive Constant
The Type of Message will be displayed in the left panel of the test result. When the message type is selected, the corresponding details are displayed in right panel.
Filter:
If we want the test result should not display any of the pass or fail status, we can set the mode of the result window while running the script.These modes can be set in Filter property of Reporter Object
The different modes are
rfEnableAll
rfEnableErrorsAndWarnings
rfEnableErrorsOnly
rfDisableAll
When no filter mode is set,the default one is rfEnableAll, where all the pass, failed and warnings are displayed in the test result
To set any mode:
Reporter.Filter = AnyMode
To Display the current mode in the test
MsgBox Reporter.Filter
Other properties of Reporter Object are Reportpath and RunStatus
Customising the Test Result
The results of each QTP run session are saved in results.xml which is located in C:\Documents and Settings\...\Local Settings\Temp\TempResults\Report. This xml file stores information on each of the test result nodes. Each node in the run results tree is an element in the results.xml file. You can create a customized .xsl file that specifies the information to be included in the printed report, and the way it should appear from this xml file.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment