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 static 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.
voiddisplay
(Stringmessage
)
message
The message to be displayed by the progress monitor.
This method may throw an exception with one of the following values:
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 exceptions and do not log it, TestManager is not aware of the exception 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.
TSSMonitor.display
("Beginning transactioin");
Gets the test script file name or line number position.
voidpositionGet
(StringBuffersrcFile
, TSSIntegerlineNumber
)
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
positionSet
() call.
lineNumber
OUTPUT. The name of a local variable. After a successful call, this variable contains the current line position in
srcFile
. For the implementation of this argument's data type, see TSSInteger.
This method may throw an exception with one of the following values:
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 exceptions and do not log it, TestManager is not aware of the exception 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.
StringBuffer scriptFile;
TSSInteger lineNumber;
TSSMonitor.positionGet
(scriptFile,lineNumber);
Sets the test script file name or line number position.
voidpositionSet
(StringsrcFile
, intlineNumber
) voidpositionSet
(intlineNumber
)
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.
These methods may throw an exception with one of the following values:
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 exceptions and do not log it, TestManager is not aware of the exception 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
.
TSSMonitor.positionSet
("checkLogin",0);
Reports the runtime status of a command.
voidreportCommandStatus
(intstatus
)
status
The status of a command. Can be one of the following:
This method may throw an exception with one of the following values:
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 exceptions and do not log it, TestManager is not aware of the exception 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.
TSSMonitor.reportCommandStatus
(TSS_CMD_STAT_FAIL);
int runStateGet
()
On success, this method returns one of the run state values listed in the run state table.
This method may throw an exception with one of the following values:
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 exceptions and do not log it, TestManager is not aware of the exception 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.
int orig = TSSMonitor.runStateGet
();
void runStateSet
(int state)
state
The run state to set. Enter one of the run state values listed in the run state table.
This method may throw an exception with one of the following values:
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 exceptions and do not log it, TestManager is not aware of the exception 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.
TSSMonitor.runStateSet
(MST_WAITRESP);
Rational Test Script Services for Java | Rational Software Corporation |
Copyright (c) 2003, Rational Software Corporation | http://www.rational.com support@rational.com info@rational.com |