Sunday, February 22, 2009

QTP Reporter Filter

Reporter.Filter:
  • Retrieves the current mode for displaying events in the Test Results.
  • Sets the current mode for displaying events in the Test Results.
  • You can use this to filter results based on Failed or Passed steps to be included in the results
  • You can use this property to completely disable or enable reporting of steps
To retrieve the mode setting:

CurrentMode = Reporter.Filter

To set the mode:

Reporter.Filter = NewMode

There are four different modes:

0 (rfEnableAll) Default. All reported events are displayed in the Test Results.
1 (rfEnableErrorsAndWarnings) only event with a warning or fail status is displayed in the Test Results.
2 (rfEnableErrorsOnly) Only events with a fail status are displayed in the Test Results.
3 (rfDisableAll) No events are displayed in the Test Results.

A Small example to get the current mode:

CurrentMode = Reporter.Filter
Select Case CurrentMode
Case 0
msgbox "rfEnableAll mode is set."
Case 1
msgbox "rfEnableErrorsAndWarnings mode is set"
Case 2
msgbox "rfEnableErrorsOnly mode is set"
Case 3
msgbox "rfDisableAll mode is set"
End select