Reporter Object
Description
The object used for sending information to the run results.
Methods and Properties
AddRunInformation | Reports an event to the run results (HTML Report only) |
CurrentActionIterationStatus | Retrieves the run status of the current iteration of an action during the test run. |
CurrentTestIterationStatus | Retrieves the run status of the current iteration of a test during the test run. |
Filter | Retrieves or sets the current mode for displaying events in the run results. |
ReportEvent | Reports an event to the run results |
ReportHtmlEvent | Reports an event to the run results, with step name and details in HTML format if applicable. |
ReportNote | Adds a note to the run results. |
ReportPath | Retrieves the folder path in which the current test's results are stored. |
RunStatus | Retrieves the run status at the current point of the run session. |
AddRunInformation Method
Description
Reports an event to the run results (HTML Report only)
Syntax
Reporter.AddRunInformation Custom Key,Description
Argument | Type | Description |
---|---|---|
Custom Key | String | The field to add to the run results. This field is added to the run results summary information in Additional Run Information (displayed at the top of the HTML report). |
Description | String | The text to report to the run results. |
The following example uses the AddRunInformation
method to add test-related configuration and version notes to the results.
Reporter.AddRunInformation "Connection Information","This test was run from IP 12.34.56.89 using a wireless connection."
CurrentActionIterationStatus Property
Description
Retrieves the run status of the current iteration of an action during the test run.
Syntax
Reporter.CurrentActionIterationStatus
The following example uses the CurrentActionIterationStatus
method to retrieve the run status of the current action iteration and exit the action if the status is fail. If the status is not fail, the test run continues.
If Reporter.CurrentActionIterationStatus = 1 Then ExitAction
CurrentTestIterationStatus Property
Description
Retrieves the run status of the current iteration of a test during the test run.
Syntax
Reporter.CurrentTestIterationStatus
The following example prints the run status of the current iteration of a test and the overall test run status.
var = DataTable.GlobalSheet.GetParameter("Test")
print var
print Reporter.CurrentTestIterationStatus
print Reporter.RunStatus
Filter Property
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 | 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 | Only events with a fail status are displayed in the Run Results. |
3 or | No events are displayed in the Run Results. |
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", ""
ReportEvent Method
Description
Reports an event to the run results
Syntax
Reporter.ReportEventEventStatus, 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. 1 or micFail: Causes the status of this step to be failed and sends the specified message to the run results. 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. |
ImageFilePath | String | Optional. Path and filename of the image to be displayed in the run results. Images in the following formats can be displayed: BMP, PNG, JPEG, and GIF. Notes:
|
The following examples use the ReportEvent
method to report a failed step.
Reporter.ReportEvent 1, "Custom Step", "The user-defined step failed."
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"
The following example uses the ReportEvent
method to include a captured bitmap of the entire desktop in the run results.
Desktop.CaptureBitmap "MyDesktop.bmp" Reporter.ReportEvent micDone, "Screenshot", "This is a screenshot of the desktop", "MyDesktop.bmp"
ReportHtmlEvent Method
Description
Reports an event to the run results, with step name and details in HTML format if applicable.
Syntax
Reporter.ReportHtmlEventEvent Status, ReportStepName, Details, [Image File Path]
Arguments
Argument | Type | Description |
---|---|---|
Event Status | String | The textual content of the note. Possible values include:
|
ReportStepName | String | Name of the step displayed in HTML format. |
Details | String | Description of the run results event. The string will be displayed in HTML format. |
Image File Path | Variant | Optional. Path and filename of the image to be displayed in the run results. Images in the following formats can be displayed:
Note: Images cannot be loaded from ALM. Including large images in the run results may impact performance. If an image is specified as a relative path, UFT One will first search the Results folder for the image and then the search paths specified in the Folders pane of the Options dialog box (Tools > Options > GUI Testing tab > Folders node). |
IMPORTANT
- This method is similar to the existing ReportEvent method. However, this method is able to report the step name and details in HTML format.
- It is important to ensure that the html string sent to the run results has correct syntax and will not affect the ability of the HTML report to display properly. Therefore, It is not recommended to use <html>, <head>,<body>, <script> tags in both step name and details.
The following example uses the ReportHtmlEvent method to report a step with step name in html and details in plain text.
Reporter.ReportHtmlEvent micDone, “Html <i>Source</i>”, “The raw html source is: <p>User-defined step.</p>”
ReportNote Method
Description
Adds a note to the run results. The note is displayed in the Executive Summary Notes section of the Result Details pane when the root node is selected in the run results tree.
Syntax
Reporter.ReportNote NoteContent
Arguments
Argument | Type | Description |
---|---|---|
NoteContent | String | The textual content of the note. |
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")
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. |
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
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 = 1 Then ExitAction
See also:
- Crypt Object
- DataTable Object
- Description Object
- DeviceReplay Object
- DotNetFactory Object
- DTParameter Object
- DTSheet Object
- Environment Object
- Extern Object
- Parameter Object
- JSON Object
- JsonUtil Object
- MercuryTimers Object (Collection)
- MercuryTimer Object
- NV Object
- OptionalStep Object
- ParallelUtil Object
- LocalParameter Object
- PasswordUtil Object
- PathFinder Object
- PDFUtil Object
- Properties Object (Collection)
- QCUtil Object
- RandomNumber Object
- Recovery Object
- Remote Connection Object
- Reporter Object
- RepositoriesCollection Object
- Repository Object
- Services Object
- Setting Object
- SystemMonitor Object
- TestArgs Object
- TextUtil Object
- UIAutomation Object
- VisualRelation Object
- VisualRelations Object
- VisualRelationsCollection Object
- WebUtil Object
- XMLUtil Object