Using Advanced Techniques>Starting from the Command Line

You can start the SilkTest Classic executable program from the command line

The syntax is:

Partner [-complog filename] [-m mach] [-opt optionset.opt] [-p mess] [-proj filename [-base filename]] [[-q] [-query query name] [-quiet] [-r filename] [-resexport] [-resextract] [-r] scr.t/suite.s/plan.pln/link.lnk [args]] [-smlog filename]

The filename specified for various options expects the file to be located in the working directory (the default location is the SilkTest Classic install directory, c:\Program Files\Silk\SilkTest\). If you want to use a file that is located in another directory, you must specify the full path in addition to the filename.

 

Options

The following table lists all the options to the partner command.

 args

Optional arguments to a script file. You can access the arguments using the GetArgs function and use them with your scripts.

If you pass arguments in the command line, the arguments provided in the command line are used and any arguments specified in the currently loaded options set are not used. To use the arguments in the currently loaded options set, do not specify arguments in the command line.

 

-complog

Tells SilkTest Classic to log compilation errors to a file you specify. Enter the argument as -complog filename. For example: partner [-complog c:\testing\logtest1.txt].

If you include this argument, each time you do a compilation SilkTest Classic checks to see if the file you named exists. If it does not already exist, SilkTest Classic creates and opens it. If the file already exists, SilkTest Classic opens it and adds the information. The number of errors is written in the format n error(s), for example 0 errors, 1 error, or 50 errors. Compilation errors are written to the error log file as they are displayed in the "Errors" window. The error log file is automatically saved and closed when SilkTest Classic finishes writing errors to it.

 

-m

Specifies the target machine. The default is the current machine. Call the 4Test built-in function Connect to connect to a different machine at runtime.

In order to use the -m switch, you need to have the Network setting of the Runtime Options dialog box set to TCP/IP or NetBIOS. If this is set to '(disabled)', the target machine is ignored. To set the Network setting, either set it interactively in the Runtime Options dialog box before running from the command line, or save the setting in an option set and add the '-opt <option set>' argument to the command line.

 

-opt

Specifies an options set. Must be followed by the path of the .opt file you want to use.

 

-p

Provided for use with a Windows shell program that is running SilkTest Classic as a batch task. The option enables another Windows program to receive a message containing the number of errors that resulted from the scripts run. SilkTest Classic broadcasts this message using the Windows PostMessage function, with the following arguments:

hWnd = HWND_BROADCAST

uiMsg = RegisterWindowMessage (mess)

wParam = 0

lParam = number of errors

To take advantage of the -p option, the shell program that runs SilkTest Classic should first register mess, and should look for mess while SilkTest Classic is running.

 

-proj

Optional argument specifying the project file or archived project to load when starting SilkTest Classic or SilkTest Classic Runtime. For example, partner –proj d:\temp\testapp.vtp –r agent.pln.

-base is an optional argument to –proj. You use the base argument to specify the location where you want to unpack the package contents. For example, partner –proj d:\temp\testapp.stp –base c:\rel30\testapp unpacks the contents of the package to the c:\rel30\testapp directory.

 

-q

Quits SilkTest Classic after the script, suite, or test plan completes.

 

-query

Specifies a query. Must be followed by the name of a saved query. Tells SilkTest to perform an Include > Open All, then Testplan > Mark By Named Query, then Run > Marked Tests.

 

-quiet

Starts SilkTest Classic in "quiet mode", which prevents any pop-up dialog boxes from displaying when SilkTest Classic starts up.

The quiet option is particularly useful when used in conjunction with the -smlog option if you are doing unattended testing where a user is not available to respond to any pop-up dialog boxes that may display. For example, partner –quiet –smlog c:\testing\meter_dialog.txt starts up SilkTest Classic and saves any SilkMeter dialog boxes to the meter_dialog.txt file.

 

-r

Must be the last option specified, followed only by the name of a SilkTest Classic file to open. This includes files such as script (and, optionally, arguments that the script takes), a suite, test plan, or link file. If you specify a link file, tells SilkTest Classic to resolve the link and attempt to open the link target. Otherwise, tells SilkTest Classic to run the specified script, suite, or test plan, optionally passing args as arguments to a script file. For example, partner –proj d:\temp\testapp.stp –base c:\rel30\testapp –r Agent.pln unpacks the archive from the temp subdirectory into the c:\rel30\testapp subdirectory and then loads and executes the Agent.pln file.

 

-resexport

Tells SilkTest Classic to export a one line summary of the most recent results sets to .rex files automatically. Specifying -resexport has the same effect as if each script run invokes the ResExportOnClose function during its execution.

 

-resextract

Tells SilkTest Classic to extract all information from the most recent results sets to a .txt file. Both the SilkTest Classic Extract menu command and the -resextract option create UTF-8 files.

 

script.t/ suite.s/ plan.pln/ link.lnk

The name of the SilkTest Classic script, suite, test plan, or link file to load, run, or open.

 

-smlog

Tells SilkTest Classic to log SilkMeter messages to a file you specify. The messages display in the log file in addition to appearing in dialog boxes. Enter the argument as -smlog filename, for example: partner [-smlog c:\testing\silkmeterlog.txt]. Some, but not all SilkMeter messages cause SilkTest Classic to close.

If you include the -smlog argument, SilkTest Classic checks to see if the file you specify exists. If it does not already exist, SilkTest Classic creates and opens it. If the file already exists, SilkTest Classic opens it and appends the information. The SilkMeter log file is automatically saved and closed when SilkTest Classic finishes writing errors to it.

See the example of using -smlog with the -quiet option.

 

Examples

To load SilkTest Classic, type: partner

To run the test.s suite, type: partner -r test.s on system "sys1"

To run the test.t script, type: partner -m sys1 -r test.t 

To run the test.t script with arguments, type: partner -r test.t arg1 arg2 

To run the tests marked by the query named query3 in tests.pln, type: partner -query query3 -r tests.pln 

To run tests.pln, and export the most recent results set from tests.res to tests.rex, type: partner -q -resexport -r tests.pln

To edit the test.inc include file, type: partner test.inc

 

*********************************************

 

You can start the Classic Agent executable program from the command line.

The syntax is:

 

agent [-p port]

 

Options

The following option is available for the agent command:

-p <port>

Temporarily set network protocol to TCP/IP and port to specified <port>. For the Classic Agent, the default port is the value in the partner.ini file. If there is no value set in the partner.ini file, then the port is set to 2965. To permanently set a protocol and port, right-click the Agent window and select Network.

Port numbers may not be negative numbers or _D.

 

Examples

To load the Classic Agent, enter: agent

To load the Classic Agent and specify network protocol to TCP/IP and port to 2965 (the default port for the Classic Agent), enter: agent -p

To load the Classic Agent and specify network protocol to TCP/IP and port to 1234, enter: agent –p 1234