3 ways on How to Turn Off or Disable QTP Results
Consider a situation where you want to “turn off” or disable QTP Results (some part of the result or the entire result itself) that is generated at the end of the test run. There may be many reasons why you may want to do this, few of which have been listed at the end of the post. Let us see the 3 different ways by which you can disable/turn off QTP results.
1. Display only certain steps in the Test Run Results. Using this method, you can control what all you want to display in the test run results. For example, you may want to display only the failed steps & not the passed ones. To do so, you would need to use the Filter Property of the Reporter Object. You can use any of the below mentioned values in the Reporter.Filter property –
|0 or rfEnableAll||Default. All reported events are displayed in the Run Results|
|1 or rfEnableErrorsAndWarnings||Only event with a warning or fail status are displayed in the Run Results.|
|2 or rfEnableErrorsOnly||Only events with a fail status are displayed in the Run Results.|
|3 or rfDisableAll||No events are displayed in the Run Results.|
Let us see an example on how this concept can be used –
Reporter.ReportEvent micPass, "Step 1", "Passed" Reporter.ReportEvent micFail, "Step 2", "Failed" 'Disable all the Results Reporter.Filter = rfDisableAll Reporter.ReportEvent micPass, "Step 3", "Passed" Reporter.ReportEvent micFail, "Step 4", "Failed" 'Enable Result Display Reporter.Filter = rfEnableAll Reporter.ReportEvent micWarning, "Step 5", "Warning" 'Enable only Errors and Warnings Reporter.Filter = rfEnableErrorsAndWarnings Reporter.ReportEvent micPass, "Step 6", "Passed" Reporter.ReportEvent micFail, "Step 7", "Failed" Reporter.ReportEvent micWarning, "Step 8", "Warning"
The test run result for the above code is shown in below figure. You can notice that Step 3 & Step 4 are not displayed in the result due to rfDisableAll, and Step 6 is not displayed due to rfEnableErrorsAndWarnings which displays only Errors and Warning messages in the Run Report.
2. Turn Off the display of Results at the end of test case run. Here you would see how you can prevent the Run Results from getting displayed every time you run a test case. Let’s see the steps involved –
a. Go to Tools -> Options.
b. Select ‘Run’ node from the left hand side pane. Deselect the check box – ‘View results when run session ends’.
c. Click on ‘Apply’ and then ‘OK’ button.
Now when you run a test case, the run results would not appear at the end of the run session. Please note that this option just prevents the run results from getting displayed, but it doesn’t prevent the run results from being generated (and saved in your system).
3. Prevent the creation of Test Run Results. Using this method you can actually prevent the run results from being generated. Thus there is no way your test results will get displayed. To do so, you can follow the below steps –
a) Go to Start -> Run. Enter regedit in the text field and click on OK button to open the Registry Editor.
b) Navigate to HKEY_LOCAL_MACHINE \ SOFTWARE \ Mercury Interactive \ QuickTest Professional \ Logger \ Media \ Report node in the Registry Editor.
c) From the right hand side pane, double click on Active option and change the value from 1 to 0.
Since you have seen the 3 ways to disable QTP Results, you might be wondering as to why is there a need to turn off/disable the run results. Listed below are 3 scenarios where you might want to suppress QTP results.
|Disable certain parts of the run result.||Let us suppose that you are using GetCellData function on a table with a large number of rows. In this situation QTP Results will display one step for each GetCellData function call (which you might want to avoid)|
|Prevent QTP Results from appearing after a run session ends.||There might be several cases where you would be running a small script multiple number of times for debugging purposes. In such situations, it becomes bit distracting & irritating to have the results screen displayed after every run.|
|Prevent QTP Results from being created.||In some of your automation framework, you might want to go with custom reporting rather than the standard QTP reporting. In such cases it’s always better to prevent the creation of QTP results. This would definitely help you save some disk space.|
Would you like to share any other scenario where you would suppress/disable the QTP Results? Please use the comments section to share your scenarios with us.