StInit Function

Action

The StInit function starts Silk Test. It is used only for web application testing (but not for mobile) and does not start a new session. Therefore, you need to enable Use particular user account in the system settings: Click Settings > System > Agents > Advanced and enable the option. All started virtual users are using the same Silk Test process within the current session.
注: Browser type settings defined using this function override profile settings that were configured in the profile settings: Profile settings > GUI-Level Testing > Execution > Browser type setting. When the optional uBrowserType parameter is omitted, the profile settings are used. The default browser type is the one that was specified during the import of the test.

Include file

StAutomation.bdh

Syntax

StInit( uBrowserType : in number optional := BROWSER_TYPE_DEFAULT ): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
uBrowserType Optional: Sets the browser type. Possible values are:
  • BROWSER_TYPE_DEFAULT := 0;
  • BROWSER_TYPE_CHROME := 1;
  • BROWSER_TYPE_FIREFOX := 2;
  • BROWSER_TYPE_PHANTOMJS := 3;

Example

dcltrans
  transaction TInit
  begin
    StInit();
  end TInit;

  transaction TTest
  begin
    StLoadProject("package.stp");
    StSetOption(ST_OPTION_TRUELOG_OPTIONS,ST_TRUELOG_ALL);
    StExecuteTestcase("scriptFile.t", "testcase", "\" testdata\",10", "MyTimer1");
    StLogoffSession();

  end TTest;