Parameters for STW.EXE

The command line program contains both mandatory and optional parameters. Parameters can be specified using either the long or short form of its name. Some of the optional parameters allow you to do things such as change your environment, send variables with a script, and create an output file.

Note: Parameter names, scripts, and script parameters are not case sensitive. However, the values of script parameters are passed through to the script as specified.
Note: You can use the / character instead of the - character to preface the parameter name.
Parameter Long Name Parameter Short Name Required Description
dsn -d Yes

The name of the DSN to use to connect to the database. Although this parameter is required, if left blank, SilkTest will be used.

username -u Yes

The name of the user used to connect. If left blank, Admin will be used.

password -p No

The password of the user used to connect. Optional if the password is Nothing (this is not recommended).

project -r No

The project that contains the scripts to play back. By default, all scripts in the project will execute. Use the -script parameter to specify unique scripts. If you do not specify a script and a script requires input parameters, the default values will be used.

.NET scripts are executed first and visual tests are executed second.

If the project does not exist, an error message will display.

Important: If the project parameter is not specified, then the Common project is used by default. For example, if you write stw -d silktest -u admin -p admin -s Script1 -r OtherProject -s Script2, Script1 will be run in the Common project, while Script2 will be run in the project called OtherProject.
environment -e No

The name of the run environment for the scripts to use. The default playback environment will be used if this parameter is not included.

If the playback environment does not exist, then the script will not be executed.

Important: If used, this parameter must precede the parameters project and script.
script -s Yes

The name of the .NET script, visual test, or keyword-driven test to play back.

If the .NET script, visual test, or keyword-driven test does not exist, an error message will display.

variable -m No

This parameter allows you to specify the parameters for a .NET script, a visual test, or a keyword-driven test. For example, you can use this parameter to pass global properties from Silk Central to a keyword-driven test.

This overrides any global properties that are defined in the asset. If you use this parameter, it must follow the script parameter.

The name and value pair should be enclosed in double quotes. Use the = character to denote a value that is assigned to a variable. The Boolean parameter should be specified as True or False.

Parameters can be specified in any order but the names and numbers must match the parameters of the script exactly. Passing too many, not enough, or invalid names will cause an error message and the script will not run.

file -f No

This option allows you to specify command line parameters in a text file and feed that to the command line program. This could be used if you have lengthy arguments that you don't want to re-type.

See Input File for full usage details.

outputfile -o No

Use this parameter to specify the name of a file that will contain information about the scripts that were executed. Only scripts that execute and either complete successfully or generate a playback error will appear in the output file.

The name of the output file must appear in quotes if the path or name contains spaces.

See Output File for full usage details.

browser -b No
Use this parameter to specify on which browser scripts that have browser application configurations are executed. The parameter is case insensitive and the following values are allowed:
  • InternetExplorer
  • Firefox
  • GoogleChrome
  • Edge
  • AndroidBrowser
  • Safari
  • None

When you want to use AndroidBrowser or Safari, specify the mobiledevice parameter.

Important: If used, this parameter must precede the parameters project and script.
commandlineargs -cla No

Use this parameter to specify command line arguments for the base state of the script. You can use this parameter with any base state that uses command line arguments. If the agent uses the command line arguments, they will be honored. Otherwise they will be ignored.

You can also use the silktest.commandLineArgs environment variable to specify command line arguments. If command line arguments are specified in both the environment variable and as parameters to STW.exe, the parameters to STW.exe are used.

Important: If used, this parameter must precede the parameter script.
viewportwidth -vw No Use this parameter to specify the width of the browser viewport in pixels. You can only use the viewportwidth parameter in combination with the viewportheight parameter. Specifying only one of the parameters will result in an error. You cannot use this parameter in combination with the viewportname parameter.
viewportheight -vh No Use this parameter to specify the height of the browser viewport in pixels. You can only use the viewportheigth parameter in combination with the viewportwidth parameter. Specifying only one of the parameters will result in an error. You cannot use this parameter in combination with the viewportname parameter.
viewportname -vn No Use this parameter to specify the width and height of the viewport by using the predefined size of a custom browser from the list in the UI. This list is visible when selecting a browser in the Select Browser dialog, the Web tab of the Select Application dialog, and the Edit Browser Application Configuration dialog. You cannot use this parameter in combination with the viewportwidth and viewportheigth parameters.
orientation -on No The orientation parameter is only considered when the viewportname is specified. Its values can be portrait or landscape. This is equivalent to the Orientation setting in the UI.
mobiledevice -md No

The name of the mobile device that the script is executed against. This name also displays in the Select Browser dialog box.

To reset this value, pass in an empty string as two double quotes ("").

Important: If used, this parameter must precede the parameters project and script.
append -a No

Use this parameter to append the result. This is the same setting as displayed in the Options dialog box.

increment -i No

Use this parameter to increment the result. This is the same setting as displayed in the Options dialog box.

verbose -v No

This parameter displays output to the user during the execution of the script. It can appear anywhere in the command line.

DSN, username, and password are always displayed. If an output file is used, it will be displayed. Where a script name is shown, the project name will appear following the name in brackets . A line containing the name of the script, project, script status, total verifications, passed verifications, and failed verifications will be shown for each script executed.

help or ? -h No

Type STW -? to display the available parameters for the command line program.

resultdir -rd No

Use this parameter to specify a directory into which all result files of the executed scripts are stored.

The following files are stored in this directory:
  • The XML result files.
  • The XSLT files that correspond to the result XML files. These are not generated if the resultformat parameter is specified with the value JUnit.
  • Error screens, if any errors occurred during the execution.

The filenames are a combination of the project name, the result name, the version, and the type of data. For example, ProjectA.resultcomment.ver12.Info.xml or ProjectA.resultcomment.ver12.Result.xml.

resultformat -rf No

Use this parameter with the resultdir parameter to specify the format of the XML file that is generated from the result.

The following values are allowed:
Workbench
Creates an XML file that contains the entries in the result and an XSLT file that is used to display the result in a browser.
JUnit
Creates an XML file of the result that is formatted for JUnit.

The default value is Workbench.

Note: If you use the resultformat parameter without the resultdir parameter, the value of the resultformat parameter is ignored.
connectionstring -c No Use this parameter to test a browser or a mobile device which is connected to a remote location. When executing a test with the connectionstring parameter, the connectionstring is written to the output file, between the mobile device and the parameters.

Example 1

This example shows the command to execute a browser script on Internet Explorer.

STW –dsn silktest –browser InternetExplorer –script MyScript

Example 2

This example shows the command to execute a browser script on both Internet Explorer and Google Chrome.

STW –dsn silktest –browser InternetExplorer –script MyScript –browser GoogleChrome –script MyScript

Example 3

This example shows the command to execute a script first against the Android browser and then on the browser that is set in the application configuration of the script.

STW –dsn silktest –browser AndroidBrowser –mobiledevice Nexus_4 –script MyScript –browser None –mobiledevice "" –script MyScript

Example 4

This example shows the command to execute all scripts in the Common project against Chrome for Android on a mobile device.

STW –dsn silktest –browser GoogleChrome –mobiledevice Nexus_4 –project Common

Example 5

This example shows the command to execute all scripts in the Common project against Chrome for Android on a mobile device that is connected to a Mac.

STW –dsn silktest -connectionstring "platformName=Android;deviceName=Moto G;host=http://MyMac - GoogleChrome" –project Common

Example 6

This example shows the command to execute a browser script on Internet Explorer with a browser viewport of size 800x600.

STW –dsn silktest –browser InternetExplorer -viewportwidth 800 -vieportheight 600 –script MyScript

Example 7

This example shows the command to execute a browser script on Internet Explorer with the browser viewport size SVGA (800, 600).

STW –dsn silktest –browser InternetExplorer -viewportname SVGA –script MyScript

Example 8

This example shows the command to execute a browser script on Mozilla Firefox with a custom profile:
STW –dsn silktest -username admin -password admin -browser Firefox -commandLineArgs "-p MyProfile" -project Common -script BrowserTest