Test Script Services Reference

prevnext

Monitor Class


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.


Applicability

Commonly used with TestManager and QualityArchitect.


Summary

The following table lists the monitoring methods. They are methods of class TSSMonitor.

Method Description
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.


TSSMonitor.Display

Sets a message to be displayed by the monitor.


Syntax

Display (message As String)

Element Description
message The message to be displayed by the progress monitor.


Error Codes

This method may generate one of the followingerror codes:

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.


Comments

This message is displayed until overwritten by another call to Display.


Example

This example sets the monitor display to Beginning transaction.

Dim monitor As Net TSSMonitor
monitor.Display "Beginning transaction"

TSSMonitor.PositionGet

Gets the test script file name or line number position.


Syntax

PositionGet (srcFile As String , lineNumber As Long )

Element Description
srcFile OUTPUT. The name of a source file. After a successful call, this variable contains the name of the source file that was specified with the most recent PositionSetcall.
lineNumber OUTPUT. The name of a local variable. After a successful call, this variable contains the current line position in srcFile .


Error Codes

This method maygenerate one of the following error codes:

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.


Comments

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.


Example

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

See Also

PositionSet


TSSMonitor.PositionSet

Sets the test script file name or line number position.


Syntax

PositionSet ([srcFile As String], [lineNumber As Long])

Element Description
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.


Error Codes

This method may generate one of the followingerror codes:

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.


Comments

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.


Example

This example sets access to the beginning of test script checkLogin.

Dim monitor As New TSSMonitor
monitor.PositionSet "checkLogin",0

See Also

PositionSet


TSSMonitor.ReportCommandStatus

Reports the runtime status of a command.


Syntax

ReportCommandStatus (status As Long)

Element Description
status The status of a command. Can be one of the following:
  • TSS_CMD_STAT_FAIL

  • TSS_CMD_STAT_PASS

  • TSS_CMD_STAT_WARN

  • TSS_CMD_STAT_INFO


Error Codes

This method may generate one of the followingerror codes:

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.


Example

This example reports a failure command status.

Dim monitor as New TSSMonitor
monitor.ReportCommandStatus TSS_CMD_STAT_FAIL

TSSMonitor.RunStateGet

Gets the run state.


Syntax

RunStateGet() As Long 

Return Value

On success, this method returns one of the run state values listed in the run state table starting on page88.


Error Codes

This method may generate one of the followingerror codes:

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.


Comments

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.


Example

This example gets the current run state.

Dim orig As Long
Dim monitor As New TSSMonitor
orig = monitor.RunStateGet

See Also

RunStateSet


TSSMonitor.RunStateSet

Sets the run state.


Syntax

RunStateSet (state As Long)

Element Description
state The run state to set. Enter one of the run state values listed in the run state table starting on page88.


Error Codes

This method may generate one of the followingerror codes:

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.


Comments

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.

Run State Meaning
MST_BIND iiop_bind in progress
MST_BUTTON X button action
MST_CLEANUP cleaning up
MST_CPUDLY cpu delay
MST_DELAY user-requested delay
MST_DSPLYRESP displaying response
MST_EXITED exited
MST_EXITSQABASIC exited SQABasic code
MST_EXTERN_C executing external C code
MST_FIND find_text find_point
MST_GETTASK waiting for task assignment
MST_HTTPCONN waiting for http connection
MST_HTTPDISC waiting for http disconnect
MST_IIOP_INVOKE iiop_invoke in progress
MST_INCL mask including above basic states
MST_INIT doing startup initialization
MST_INITTASK initializing task
MST_ITDLY intertask delay
MST_MOTION X motion
MST_PMATCH matching response (precv)
MST_RECV_DELAY line_speed delay in recv
MST_SATEXEC executing satellite script
MST_SEND httpsocket send
MST_SEND_DELAY line_speed delay in send
MST_SHVBLCK blocked from shv access
MST_SHVREAD V_VP: reading shared variable
MST_SHVWAIT user requested shv wait
MST_SOCKCONN waiting for socket connection
MST_SOCKDISC waiting for socket disconnect
MST_SQABASIC_CODE running SQABasic code
MST_SQLCONN waiting for SQL client connection
MST_SQLDISC waiting for SQL client disconnect
MST_SQLEXEC executing SQL statements
MST_STARTAPP SQABasic: starting app
MST_SUSPENDED suspended
MST_TEST test case, emulate
MST_THINK thinking
MST_TRN_PACING transactor pacing delay
MST_TUXEDO Tuxedo execution
MST_TYPE typing
MST_UNDEF user's micro_state is undefined
MST_USERCODE SQAVu user code
MST_WAITOBJ SQABasic: waiting for object
MST_WAITRESP waiting for response
MST_WATCH interactive -W watch record
MST_XCLNTCONN waiting for http connection
MST_XCLNTCONN waiting for socket connection
MST_XCLNTCONN waiting for SQL client connection
MST_XCLNTCONN waiting for X client connection
MST_XCLNTDISC waiting for http disconnect
MST_XCLNTDISC waiting for socket disconnect
MST_XCLNTDISC waiting for SQL client disconnect
MST_XCLNTDISC waiting for X client disconnect
MST_XMOVEWIN X move window
MST_XQUERY X query function
MST_XSYNC X sync state during X query
MST_XWINCMP xwindow_diff comparing windows
MST_XWINDUMP xwindow_diff dumping window
N_MST_INCL number of above states


Example

This example sets the run state to MST_WAITRESP.

Dim monitor As New TSSMonitor
monitor.RunStateSet MST_WAITRESP

See Also

RunStateGet

prevnext


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