StExecuteTestcase Function

Action

StExecuteTestcase starts an execution in Silk Test and collects the results of the execution. The script file can be provided with an absolute path if no project has been loaded. When a package is loaded by Silk Test, the relative path of the script within the package must be used.

Include file

StAutomation.bdh

Syntax

StExecuteTestcase(
      in sScript   : string,
      in sTestCase : string,
      in sTestData : string,
      in sTimer    : string ): boolean;

Return value

  • true if the execution was successful

  • false otherwise

Parameter Description
sScript The script name of the Silk Test script. If a package has been loaded, the relative path (within the package) of the script must be provided. If no package has been loaded, the script should be added to the data files and only the name of the script must be provided.
sTestCase The name of the testcase you want to execute.
sTestData The test data that must be passed to the testcase. Strings that are passed must begin and end with an \".
sTimer The name of the timer for the StExecuteTestcase function. The timer starts when Silk Test gets the information to execute a testcase and stops when Silk Test finishes the execution.

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);
    StExecuteTestcase("scriptFile.t", "testcase", "\" testdata\",10", "MyTimer1");    
    StLogoffSession();  
  end;
end TMain;