Test Script Services Reference |
When a suite of test cases or test scripts is played back, TestManager monitors execution progress and provides a number of monitoring options. The monitoring methods support the TestManager monitoring options.
Commonly used with TestManager and QualityArchitect.
The following table lists the monitoring methods. They are methods of class TSSMonitor
.
Display
Sets a message to be displayed by the monitor.
PositionGet
Gets the script source file name or line number position.
PositionSet
Sets the script source file name or line number position.
ReportCommandStatus
Gets the runtime status of a command.
RunStateGet
Gets the run state.
RunStateSet
Sets the run state.
Sets a message to be displayed by the monitor.
Display
(message
As String)
message
The message to be displayed by the progress monitor.
This method may generate one of the followingerror codes:
ERROR_CONVERT_BSTR
. An encountered string cannot be converted.
ERROR_INVALID_PARM
. A required argument is missing or invalid.
TSS_NOOP
. The TSS server is running proxy.
TSS_NOSERVER
. No previous successful call to TSSSession.Connect
.
TSS_ABORT
. Pending abort resulting from a user request to stop a suite run.
If you handle one of these errors and do not log it, TestManager is not aware of the error and does not log a Fail result for it. The script continues to run, and TestManager could log a Pass result for the script.
This message is displayed until overwritten by another call to Display.
This example sets the monitor display to Beginning transaction.
Dim monitor As Net TSSMonitor
monitor.Display
"Beginning transaction"
Gets the test script file name or line number position.
PositionGet
(srcFile
As String , lineNumber
As Long )
This method maygenerate one of the following error codes:
TSS_NOSERVER
. No previous successful call to TSSSession.Connect
.
TSS_ABORT
. Pending abort resulting from a user request to stop a suite run.
If you handle one of these errors and do not log it, TestManager is not aware of the error and does not log a Fail result for it. The script continues to run, and TestManager could log a Pass result for the script.
TestManager monitoring options include Script View, causing test script lines to be displayed as they are executed. PositionSet and PositionGet partially support this monitoring option for TSS scripts: if line numbers are reported, they are displayed during playback but not the contents of the lines.
The line number returned by this function is the most recent value that was set by PositionSet. A return value of 0 for line number indicates that line numbers are not being maintained.
This example gets the name of the current script file and the number of the line to be accessed next.
Dim scriptFile As String
Dim lineNumber As Long
Dim monitor as New TSSMonitor
monitor.PositionGet
scriptFile, lineNumber
Sets the test script file name or line number position.
PositionSet
([srcFile
As String], [lineNumber
As Long])
srcFile
The name of the test script, or NULL for the current test script.
lineNumber
The number of the line in
srcFile
to set the cursor to, or 0 for the current line.
This method may generate one of the followingerror codes:
ERROR_CONVERT_BSTR
. An encountered string cannot be converted.
ERROR_INVALID_PARM
. A required argument is missing or invalid.
TSS_NOSERVER
. No previous successful call to TSSSession.Connect
.
TSS_ABORT
. Pending abort resulting from a user request to stop a suite run.
If you handle one of these errors and do not log it, TestManager is not aware of the error and does not log a Fail result for it. The script continues to run, and TestManager could log a Pass result for the script.
TestManager monitoring options include Script View, causing test script lines to be displayed as they are executed. PositionSet and PositionGet partially support this monitoring option for TSS scripts: if line numbers are reported, they are displayed during playback but not the contents of the lines.
This example sets access to the beginning of test script checkLogin
.
Dim monitor As New TSSMonitor
monitor.PositionSet
"checkLogin",0
Reports the runtime status of a command.
ReportCommandStatus
(status
As Long)
status
The status of a command. Can be one of the following:
This method may generate one of the followingerror codes:
TSS_NOOP
. The TSS server is running proxy.
TSS_NOSERVER
. No previous successful call to TSSSession.Connect
.
TSS_INVALID
. The entered status
is invalid.
TSS_ABORT
. Pending abort resulting from a user request to stop a suite run.
If you handle one of these errors and do not log it, TestManager is not aware of the error and does not log a Fail result for it. The script continues to run, and TestManager could log a Pass result for the script.
This example reports a failure command status.
Dim monitor as New TSSMonitor
monitor.ReportCommandStatus
TSS_CMD_STAT_FAIL
RunStateGet
() As Long
On success, this method returns one of the run state values listed in the run state table starting on page88.
This method may generate one of the followingerror codes:
TSS_NOSERVER
. No previous successful call to TSSSession.Connect
.
TSS_ABORT
. Pending abort resulting from a user request to stop a suite run.
If you handle one of these errors and do not log it, TestManager is not aware of the error and does not log a Fail result for it. The script continues to run, and TestManager could log a Pass result for the script.
This call is useful for storing the current run state so you can change the state and then subsequently do a reset to the original run state.
This example gets the current run state.
Dim orig As Long
Dim monitor As New TSSMonitor
orig = monitor.RunStateGet
RunStateSet
(state
As Long)
state
The run state to set. Enter one of the run state values listed in the run state table starting on page88.
This method may generate one of the followingerror codes:
TSS_NOSERVER
. No previous successful call to TSSSession.Connect
.
TSS_INVALID
. Invalid run state.
TSS_ABORT
. Pending abort resulting from a user request to stop a suite run.
If you handle one of these errors and do not log it, TestManager is not aware of the error and does not log a Fail result for it. The script continues to run, and TestManager could log a Pass result for the script.
TestManager includes the option to monitor script progress individually for different virtual testers. The run states are the mechanism used by test scripts to communicate their progress to TestManager. Run states can also be logged and can contribute to performance analysis reports.
The following table lists the TestManager run states.
This example sets the run state to MST_WAITRESP.
Dim monitor As New TSSMonitor
monitor.RunStateSet
MST_WAITRESP
Rational Test Script Services for Visual Basic | Rational Software Corporation |
Copyright (c) 2003, Rational Software Corporation | http://www.rational.com support@rational.com info@rational.com |