Recent Post

QTP - Reporter Utility

QTP - Reporter Utility

What is Reporter Utility in QTP?

How to use Reporter Utility in QTP?

Different methods and properties of QTP - Report Utility 


ReportEvent Method

Description
Reports an event to the run results.
Syntax
Reporter.ReportEvent EventStatus, ReportStepName, Details [, ImageFilePath]
Argument
Type
Description
EventStatus
Number or pre-defined constant
Status of the Run Results step:
0 or micPass: Causes the status of this step to be passed and sends the specified message to the Run Results window.
1 or micFail: Causes the status of this step to be failed and sends the specified message to the Run Results window. When this step runs, the test or component fails.
2 or micDone: Sends a message to the Run Results window without affecting the pass/fail status of the test or component.
3 or micWarning: Sends a warning message to the Run Results window, but does not cause the test or component to stop running, and does not affect the pass/fail status of the test or component.
ReportStepName
String
Name of the step displayed in the Run Results window.
Details
String
Description of the Run Results event. The string will be displayed in the step details frame in the Run Results window.
ImageFilePath
String
Optional. Path and filename of the image to be displayed in the Captured Data pane of the Run 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 run 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 run results.
Browser("Browser").Page("WebPage").Image("MyLogo").CaptureBitmap("MyLogo.bmp")
Reporter.ReportEvent micDone, "Display Logo", "This is my logo", "MyLogo.bmp"




ReportNote Method

Description
Adds a note to the run results. The note is displayed in the Executive Summary Notessection of the Result Details pane when the root node is selected in the run results tree.
Syntax
Reporter.ReportNote NoteContent
Argument
Type
Description
NoteContent
String
The textual content of the note.
Example
The following examples use the ReportNote method to add test-related configuration and version notes to the results.
Reporter.ReportNote "This test was run from IP 12.34.56.89 using a wireless connection."
Reporter.ReportNote "This test was run on version " & DataTable.GlobalSheet.GetParameter("App_Version_Value")
Reporter.ReportNote "The current test configuration is " & Environment("ConfigFile")


Reporter.Filter

Description
Retrieves or sets the current mode for displaying events in the Run 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 Run Results.
1 orrfEnableErrorsAndWarnings
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.

Example

The following example uses the Filter property to report the following events in the Run 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", ""



ReportPath Property


Description
Retrieves the folder path in which the current test's results are stored.
Note: Do not use this property to attempt to set the results folder path.
Syntax
Path = Reporter.ReportPath
Argument
Type
Description
Path
String
The folder path in which the current test's results are stored.
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)



RunStatus Property

Description
Retrieves the run status at the current point of the run session. For tests, it returns the status of current test during the test run. For business components, it returns the status of current business component (not the entire business process test).
Syntax
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

0 comments:

Post a Comment

GAReddy @ OneTestingCenter @ All Articles