StSetOption Function

Action

With the StSetOption function, it is possible to set Silk Test-specific options. Most of the options that are necessary for StLoadProject are already set. To change them you have to call StSetOption after the StLoadProject call.

Include file

StAutomation.bdh

Syntax

StSetOption( in sOption : string,
             in sValue  : string ): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
sOption The option name you want to set. The following constants can be set:
  • ST_OPTION_OPENFILE: Opens any file in a Silk Test child window.
  • ST_OPTION_OPTIONSET: Opens an option set file.
  • ST_OPTION_WORKDIR: Sets the Silk Test working directory.
  • ST_OPTION_SETHOSTNAME: Sets the remote host name for TCP/IP networks.
  • ST_OPTION_TRUELOG_OPTIONS: Sets Truelog options for the writing of TrueLogs. Use the option ST_TRUELOG_ALL to log everything. Otherwise, create your own option string. For detailed information, go to: Truelog option strings.
    注: This option only supports the Classic Agent of Silk Test. If you run tests with the Open Agent, this setting has no impact.
sValue The value of the option.

Truelog option strings

The syntax of a Truelog option string is:

OptionString  = "<name pair>{,<name pair>{,<name pair>{...}}}"
Name Pair = <sub-option name>=<option value>
Sub-option Name Option Value Description
RecordingLevel Error | Warning | All Result file recording level for prompts and warnings.
BitMapsOnError TRUE | FALSE Record bit maps when errors occur.
BitMaps TRUE | FALSE Record bit maps for all selected controls, etc.
DeskTopBitMap TRUE | FALSE Record a bitmap of the desktop.
CallStackTrace TRUE | FALSE Record call stack.
AgentRecord TRUE | FALSE Enable recording of selected controls.
SetText NONE | BEFORE | AFTER | BOTH Record the SetText method.
SetMultiText NONE | BEFORE | AFTER | BOTH Record the SetMultiText method.
Select NONE | BEFORE | AFTER | BOTH Record the Select method.
PickMenu NONE | BEFORE | AFTER | BOTH Record the MenuPick method.
TypeKeys NONE | BEFORE | AFTER | BOTH Record the TypeKeys method.
MouseClick NONE | BEFORE | AFTER | BOTH Record the MouseClick method.
PresRelKeys NONE | BEFORE | AFTER | BOTH Record the Press or Release Keys method.
PresRelMouse NONE | BEFORE | AFTER | BOTH Record the Press or Release Mouse method.
SetActive NONE | BEFORE | AFTER | BOTH Record the SetActive method.
DoubleClick NONE | BEFORE | AFTER | BOTH Record the DoubleClíck method.
DoubleSelect NONE | BEFORE | AFTER | BOTH Record the DoubleSelect method.
CreateWindow NONE | BEFORE | AFTER | BOTH Record the CreateWindow method
CloseWindow NONE | BEFORE | AFTER | BOTH Record the CloseWindow method.
LowLevelEnable TRUE | FALSE Enable low level action recording.
RecordObjects TRUE | FALSE Record Control Objects.
RecordStaticText TRUE | FALSE Record Static Text (mostly browsers)
TrackObjects TRUE | FALSE Record Object Tracking (add / delete)
BrowserDownLoad TRUE | FALSE Record DOM download events.
BrowserNavigate TRUE | FALSE Record DOM navigate events.
BrowserTerminate TRUE | FALSE Record DOM terminate events.
BrowserNewWindow TRUE | FALSE Record DOM new window events.
BrowserRecStat TRUE | FALSE Record DOM Rec Stat events.
BrowserJavaScript TRUE | FALSE Record Java events
WindowDelay INT Value Windows delay for Java
Example:
"BitMaps=TRUE,AgentRecord=TRUE,SetText=AFTER"

Example

transaction TMain
var
  sUser     : string;
  sPassword : string;
begin
  AttributeGetString("Username", sUser);
  AttributeGetString("Password", sPassword);
  if (StInitSession(sUser, sPassword)) then
    StLoadProject("package.stp");
    StSetOption(ST_OPTION_TRUELOG_OPTIONS, ST_TRUELOG_ALL);
    StSetOption(ST_OPTION_WORKDIR,"<path>");
    StExecuteTestcase("scriptFile.t", "testcase", "\" testdata\",10", "MyTimer1");
    StLogoffSession();
  end;
end TMain;