Test Script Services Reference

prevnext

Advanced Commands


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.


Summary

The following table lists the advanced commands.

Command Description
InternalVarSet Sets the value of an internal variable.
LogCommand Logs a command event.
ThinkTime Calculates a think-time average.


InternalVarSet

Sets the value of an internal variable.


Syntax

tsscmd InternalVarSet internVar ivVal

Element Description
internVar The internal variable to operate on. Internal variables and their values are listed in the InternalVar table.
ivVal The new value for internVar.


Return Value

The command exits with one of the following results:


Comments

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.


Example

This example sets cmdcnt to 0.

tsscmd InternalVarSet cmdcnt 0

See Also

InternalVarGet


LogCommand

Logs a command event.


Syntax

tsscmd LogCommand [-desc description] [-start starttime] [-end 
endtime] name label result logdata [property=value ...]

Element Description
description Contains the string to be displayed in the event of failure.
starttime An integer indicating a time stamp. If omitted or specified as 0, the logged time stamp is the later of the values contained in internal variables fcs_ts and fcr_ts.
endtime An integer indicating a time stamp. If omitted or specified as 0, the time set by CommandEnd is logged.
name The command name.
label The event label.
result Specifies the notification preference regarding the result of the call. Can be one of the following:
  • NONE (default: no notification)

  • PASS

  • FAIL

  • WARN

  • STOPPED

  • INFO

  • COMPLETED

  • UNEVALUATED

logdata Text to be logged describing the ended command.
property=value Specifies one or more property-value pairs


Return Value

This command exits with one of the following results:


Comments

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.


Example

This example logs a message for a login script.

tsscmd LogCommand -d "Command timer failed" Login initTimer PASS

See Also

CommandStart, CommandEnd


ThinkTime

Calculates a think-time average.


Syntax

thinkTime = `tsscmd ThinkTime [thinkAverage]`

Element Description
thinkAverage If specified as 0, the number of milliseconds stored in the ThinkAvg environment variable is entered. Otherwise, the value specified overrides ThinkAvg.


Return Value

On success, this command returns a calculated think-time average. An exit value of 1 indicates an error. Call ErrorDetail for more information.


Comments

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.


Example

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`

See Also

Think

prevnext


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