Test Script Services |
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 functions support the TestManager monitoring options.
The following table lists the monitoring functions.
TSSDisplay()
Sets a message to be displayed by the monitor.
TSSPositionGet()
Gets the script source file name or line number position.
TSSPositionSet()
Sets the script source file name or line number position.
TSSReportCommandStatus()
Gets the runtime status of a command.
TSSRunStateGet()
Gets the run state.
TSSRunStateSet()
Sets the run state.
Sets a message to be displayed by the monitor.
s32TSSDisplay
(char *message
)
message
The message to be displayed by the progress monitor.
This function exits with one of the following results:
TSS_OK.
Success.
TSS_NOOP
. The TSS server is running proxy.
TSS_NOSERVER
. No previous successful call to TSSConnect()
.
TSS_ABORT
. Pending abort resulting from a user request to stop a suite run.
This message is displayed until overwritten by another call to TSSDisplay().
This example sets the monitor display to Beginning transaction.
s32 retVal = TSSDisplay
("Beginning transaction");
Gets the test script file name or line number position.
s32TSSPositionGet
(char **srcFile
, u32 *lineNumber
)
On success, this function returns srcFile
and lineNumber
as explained in the preceding table. The function exits with one of the following results:
TSS_OK.
Success.
TSS_NOSERVER
. No previous successful call to TSSConnect()
.
TSS_ABORT
. Pending abort resulting from a user request to stop a suite run.
TestManager monitoring options include Script View, causing test script lines to be displayed as they are executed. TSSPositionSet() and TSSPositionGet() 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 TSSPositionSet(). 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.
char ** scriptFile;
u32 *lineNumber;
s32 retVal = TSSPositionGet
(scriptFile,lineNumber);
Sets the test script file name or line number position.
s32TSSPositionSet
(char *srcFile
, u32lineNumber
)
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 function exits with one of the following results:
TSS_OK.
Success.
TSS_NOSERVER
. No previous successful call to TSSConnect()
.
TSS_ABORT
. Pending abort resulting from a user request to stop a suite run.
TestManager monitoring options include Script View, causing test script lines to be displayed as they are executed. TSSPositionSet() and TSSPositionGet() 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
.
s32 retVal = TSSPositionSet
("checkLogin",0);
Reports the runtime status of a command.
s32 TSSReportCommandStatus
(s32 status)
status
The status of a command. Can be one of the following:
This function exits with one of the following results:
TSS_OK.
Success.
TSS_NOOP
. The TSS server is running proxy.
TSS_NOSERVER
. No previous successful call to TSSConnect()
.
TSS_INVALID
. The entered status
is invalid.
TSS_ABORT
. Pending abort resulting from a user request to stop a suite run.
This example reports a failure command status.
s32 retVal = TSSReportCommandStatus
(TSS_CMD_STAT_FAIL);
s32 TSSRunStateGet
(void)
On success, this function returns one of the run state values listed in the run state table starting on page92. The function exits with one of the following results:
TSS_NOSERVER
. No previous successful call to TSSConnect()
.
TSS_ABORT
. Pending abort resulting from a user request to stop a suite run.
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.
s32 orig = TSSRunStateGet
();
s32TSSRunStateSet
(RunStatestate
)
state
The run state to set. Enter one of the run state values listed in the run state table starting on page92.
This function exits with one of the following results:
TSS_OK.
Success.
TSS_NOSERVER
. No previous successful call to TSSConnect()
.
TSS_INVALID
. Invalid run state.
TSS_ABORT
. Pending abort resulting from a user request to stop a suite run.
RunState is defined as follows:
typedef u32 RunState;
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.
s32 retVal = TSSRunStateSet
(MST_WAITRESP);
Rational TestManager Extensibility Reference | Rational Software Corporation |
Copyright (c) 2003, Rational Software Corporation | http://www.rational.com support@rational.com info@rational.com |