Report Event Filter QTP

Description

Reports an event to the test results.

Syntax

Reporter.ReportEvent EventStatus, ReportStepName, Details [, ImageFilePath]



Argument

Type

Description

EventStatus

Number or pre-defined constant

Status of the Test Results step:

0 or micPass: Causes the status of this step to be passed and sends the specified message to the Test Results window.

1 or micFail: Causes the status of this step to be failed and sends the specified message to the Test Results window. When this step runs, the test fails.

2 or micDone: Sends a message to the Test Results window without affecting the pass/fail status of the test.

3 or micWarning: Sends a warning message to the Test Results window, but does not cause the test to stop running, and does not affect the pass/fail status of the test.

ReportStepName

String

Name of the step displayed in the Test Results window.

Details

String

Description of the Test Results event. The string will be displayed in the step details frame in the Test Results window.

ImageFilePath

String

Optional. Path and filename of the image to be displayed in the Results Details tab of the Test Results window. Images in the following formats can be displayed: BMP, PNG, JPEG, and GIF.

Notes:

  • Images cannot be loaded from Quality Center.

  • Including large images in the test results may impact performance.

  • If an image is specified as a relative path, QuickTest will first search the Results folder for the image and then the search paths specified in the Folders pane of the Options dialog box.

Examples

The following examples use the ReportEvent method to report a failed step.

Reporter.ReportEvent 1, "Custom Step", "The user-defined step failed."

or

Reporter.ReportEvent micFail, "Custom Step", "The user-defined step failed."

The following example uses the ReportEvent method to include a captured bitmap in the test results.

Browser("Browser").Page("WebPage").Image("MyLogo").CaptureBitmap("MyLogo.bmp")

Reporter.ReportEvent micDone, "Display Logo", "This is my logo", "MyLogo.bmp"

Description

Retrieves or sets the current mode for displaying events in the Test Results. You can use this property to completely disable or enable reporting of steps following the statement, or you can indicate that you only want subsequent failed or failed and warning steps to be included in the report.

Syntax

To retrieve the mode setting:

CurrentMode = Reporter.Filter

To set the mode:

Reporter.Filter = NewMode

The mode can be one of the following values:



Mode

Description

0 or
rfEnableAll

Default. All reported events are displayed in the Test Results.

1 or rfEnableErrorsAndWarnings

Only event with a warning or fail status are displayed in the Test Results.

2 or
rfEnableErrorsOnly

Only events with a fail status are displayed in the Test Results.

3 or
rfDisableAll

No events are displayed in the Test Results.

Example

The following example uses the Filter property to report the following events in the Test Results: 1, 2, 5, and 6.

Reporter.ReportEvent micGeneral, "1", ""

Reporter.ReportEvent micGeneral, "2", ""

Reporter.Filter = rfDisableAll

Reporter.ReportEvent micGeneral, "3", ""

Reporter.ReportEvent micGeneral, "4", ""

Reporter.Filter = rfEnableAll

Reporter.ReportEvent micGeneral, "5", ""

Reporter.ReportEvent micGeneral, "6", ""
Example

The following example uses the ReportPath property to retrieve the folder in which the results are stored and displays the folder in a message box.

dim Path

Path = Reporter.ReportPath

MsgBox (Path)
Reporter.RunStatus

Example

The following 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.

If Reporter.RunStatus = micFail Then ExitAction

Post a Comment

أحدث أقدم