Test Script Services Reference |
You can use the advanced commands to perform timing calculations, logging operations, and internal variable initialization functions. TestManager performs these operations on behalf of scripts in a safe and efficient manner. Consequently, the functions need not and usually should not be performed by individual test scripts.
The following table lists the advanced commands.
InternalVarSet
Sets the value of an internal variable.
LogCommand
Logs a command event.
ThinkTime
Calculates a think-time average.
Sets the value of an internal variable.
tsscmdInternalVarSet
internVar ivVal
internVar
The internal variable to operate on. Internal variables and their values are listed in the InternalVar table.
ivVal
The new value for
internVar
.
The command exits with one of the following results:
The values of some internal variables affect think-time calculations and the contents of log events. Setting a value incorrectly could cause serious misbehavior in a script.
This example sets cmdcnt
to 0.
tsscmd InternalVarSet
cmdcnt 0
tsscmdLogCommand
[-descdescription
] [-startstarttime
] [-endendtime
]name
label
result
logdata
[property
=value
...]
This command exits with one of the following results:
The value of cmdcnt
is logged with the event.
The command name and label entered with CommandStart are logged, and the run state is restored to the value that existed prior to the CommandStart call.
An event and any data associated with it are logged only if the specified result
preference matches associated settings in the LogData_control
or LogEvent_control
environment variables. (See Arguments of EnvironmentOp.) Alternatively, the logging preference may be set with the Log_level
and Record_level
environment variables. The STOPPED, COMPLETED, and UNEVALUATED preferences are intended for internal use.
This example logs a message for a login script.
tsscmd LogCommand
-d "Command timer failed" Login initTimer PASS
Calculates a think-time average.
thinkTime = `tsscmdThinkTime
[thinkAverage
]`
thinkAverage
If specified as 0, the number of milliseconds stored in the
ThinkAvg
environment variable is entered. Otherwise, the value specified overrides ThinkAvg
.
On success, this command returns a calculated think-time average. An exit value of 1 indicates an error. Call ErrorDetail
for more information.
This call calculates and returns a think time using the same algorithm as Think. But unlike Think
, this call inserts no pause into a script.
This function could be useful in a situation where a test script calls another program that, as a matter of policy, does not allow a calling program to set a delay in execution. In this case, the called program would use ThinkTime
to recalculate the delay requested by Think
before deciding whether to honor the request.
This example calculates a pause based on a think-time average of 5000 milliseconds.
ctime = `tsscmd GetTime`
tsscmd InternalVarSet fcs_ts ctime
tsscmd InternalVarSet lcs_ts ctime
tsscmd InternalVarSet fcr_ts ctime
tsscmd InternalVarSet fcr_ts ctime
pause = `tsscmd ThinkTime
5000`
The Command Line Interface to Rational Test Script Services | Rational Software Corporation |
Copyright (c) 2003, Rational Software Corporation | http://www.rational.com support@rational.com info@rational.com |