The command line supports the execution of any number of scripts in one execution of STW.EXE. The command line also supports input and output files and changing the project and run environments on a script-by-script basis.
STW -help
STW -project ProjectName
STW -project ProjectName -script ScriptName
STW -s scriptname
The command line will use SilkTest as the DSN and Admin as the username with no password.
STW -script "Script with spaces"
STW -script Script1 -script Script2
STW
In this example two different scripts are executed, since you can have the same script name in different projects, these refer to two unique scripts.
STW -project Project1 -script Script1 -project Project2 -script Script1
STW -project Project1 -script Script1 -script Script2 -project Common -script Script1 -script Script2
STW –file FileA.txt
Where the following is contained within FileA.txt:
# Execute my script -script MyScript # Change the environment and run again -environment MyEnvironment -script MyScript
STW -environment PlaybackEnvironment -s ScriptName
This example shows the same script being executed with a user defined run environment and the default run environment.
STW -environment MyRunEnv -script Script1 -environment -script Script1
The second use of -environment does not specify a name, it just resets the environment back to the default.
When executing a .NET script, visual test, or keyword-driven test that has parameters through the command line, you can specify the parameters of the asset by using the variable parameter. This overrides any global properties that are defined in the asset.
STW -script ScriptWithParameters -variable "var1=1234" "var2=Hello" "var3=True"
STW -u Admin -verbose -d MyDsn -s MyScript
The following is an example of output in verbose mode:
STW.exe Copyright (c) 1996-2011, Micro Focus IP Development Limited. All Rights Reserved DSN : STW-Scratch Username : admin Password : Script(s) : MyScript [Project3] Append result : False Increment result : False Output file : MyOutput.txt Verbose Mode : ON Searching executable assets... .NET Script ' MyScript' [Project3] found Executing MyScript [Project3] ... Script: MyScript [Project3], Status: Failed, Verifications: Total 5, Passed 0, Failed 5
STW -outputfile C:\Temp\MyFile.txt
STW -s scriptname -resultdir C:\Temp\TestResultsor
STW -s scriptname -rd C:\Temp\TestResults