Articles

[Collapse]TestComplete/viewarticle/88628/
 [Expand]General Information/viewarticle/88628/
 [Expand]Using Help System/viewarticle/81465/
 [Expand]Getting Started Tutorial/viewarticle/82003/
 [Collapse]Using TestComplete/viewarticle/84431/
  [Expand]TestComplete User Interface, Projects and Settings/viewarticle/87798/
  [Expand]Creating, Recording and Running Tests/viewarticle/88044/
  [Expand]Test Results/viewarticle/80579/
  [Expand]Enhancing Tests/viewarticle/83506/
  [Expand]Teamwork and Integration Into QA Process/viewarticle/84972/
  [Expand]Extending TestComplete/viewarticle/81408/
  [Collapse]Automating TestComplete/viewarticle/88022/
   [Collapse]Command Line and Exit Codes/viewarticle/83112/
     TestComplete Command Line/viewarticle/81120/
     TestComplete Exit Codes/viewarticle/81435/
   [Expand]Working With TestComplete via COM/viewarticle/87335/
  [Expand]Best Practices/viewarticle/87218/
 [Expand]Testing Types/viewarticle/85355/
 [Expand]Applications Testing/viewarticle/83383/
 [Expand]Working With Application Objects and Controls/viewarticle/81481/
 [Expand]Samples and Tutorials/viewarticle/81997/
 [Expand]References/viewarticle/82523/
 [Expand]Other Tools That Help You Test Better/viewarticle/82893/
 [Expand]Licensing Guide/viewarticle/88365/
Updated: 7/26/2016 Applies To: TestComplete 12 Rating: AverageAverageAverageAverageAverage 5 vote(s) Click to rate: PoorNot badAverageGoodExcellent
Command-Line Arguments and Exit Codes

TestComplete Command Line

In general, the TestComplete command line is as follows:

TestComplete.exe [file_name [/run 
[(/project:project_name| (/project:project_name /projectitem:item_name|
 (/project:project_name /test:test_name|
 (/project:project_name /unit:unit_name /routine:routine_name)] 
[/ExportLog:File_name] [/ExportLogToXMLAlso] [/exit]]
[/SilentMode [/ErrorLog:File_name] [/ForceConversion]] ]
[Timeout:time_in_seconds] [/ns] [/agpatcheroff]
[/install:extension_name] [/uninstall:extension_name] [/RestServerPort:port]

Here the parenthesis mean the group of command-line arguments. The “|” means OR, for example, “/r | /run” means you can use either /r OR /run. Square brackets mean the argument or group of arguments is optional. Below is the description of the command-line arguments that the TestComplete executable accepts:

  • file_name - Launches TestComplete and loads the specified project (.mds file) or project suite (.pjs) into it.

  • /run (or /r) - Commands TestComplete to execute tests provided by the project suite or project specified by the file_name argument or tests provided by a project item or script routine that belongs to this project suite or project. The action TestComplete will perform depends on what other command-line arguments are specified:

    /project:project_name

    TestComplete will run all enabled test items of the specified project. Project_name is the name of the project as it is shown in the Project Explorer panel.

    Note: Do not confuse test items with project items. Test items are tests that you include in the project run on the Test Items page of the project editor. Project items are project elements that belong to the project and that are shown in the Project Explorer panel.
     
    When you run a test project, TestComplete executes only those test items that are selected on the Test Items page. The unselected items are not run.
    /project:project_name  /projectitem:item_name

    TestComplete will run test(s) provided by the specified project item. Project_name specifies the name of the project that holds the desired project item (use the same name as the name shown in the Project Explorer panel). Item_name is the name of the desired project item.

    Note: Do not confuse project items with test items. Test items are what is displayed on the Test Items page of the project editor. Project items are project elements that are shown in the Project Explorer panel. The /projectitem command-line argument must specify the name of a project item.

    Using this argument, you can run only those project items that have the Run item in their context menu. For example, in this way, you can run the Network Suite project item.

    /project:project_name  /test:test_name

    TestComplete will run the specified test. This can be any of the following:

    • A keyword test

    • A script routine

    • A low-level procedure

    • A network suite

    • A network suite’s job

    • A network suite’s task

    • A manual test

    • A Selenium or unit test

    • A Ready! API test

    Project_name specifies the name of the project that holds the needed test (use the same name as that shown in the Project Explorer panel).

    Test_name is the full name of the needed test. The full name of a test includes the name of the test's parent project item and the test name, which are separated by the pipe character ( | ). For script tests, the full name also includes the the name of the unit. Enclose your tests' full names in quotation marks.

    For example:

    "KeywordTests|Test1"

    "LLCollection1|LLP1"

    "ManualTests|ManualTest1"

    "ReadyAPI1|Test1"

    "UnitTesting1|NUnit1"

    "Script|Unit1|Main"

    "NetworkSuite|Jobs|Job1|Job1" (For a network suite’s jobs, the name of the Jobs collection and the name of the job are the same)

    "NetworkSuite|Jobs|Job1|Task1"

    The full name of a test should not contain the name of the Advanced folder or names of other logical project folders.

    /project:project_name  /unit:unit_name  /routine:routine_name

    TestComplete will run the specified script routine. Project_name specifies the name of the project to which the routine belongs. Unit_name specifies the name of the unit holding the desired routine. Routine_name is the name of the script routine to be called. The routine to be called must not use parameters or return any values. Project_name and unit_name should be the same as the project and unit names shown in the Project Explorer.

    No /project, /unit or /routine arguments specified.

    TestComplete will run the tests provided by the opened project suite.

    Notes:

    • Pay attention to the colon between the argument name and the element to which the argument refers. The colon separates the argument name and the element name. Do not insert spaces before or after the colon.

    • If the project name includes spaces, it must be enclosed in double quotes: /project:"My project".

    • The argument names can be shortened. /project can be replaced with /p, /projectitem - with /pi, /test - with /t,/unit - with /u and /routine - with /rt.

  • /ExportLog:File_name (or /el:File_name) - Commands TestComplete to export test results to an .MHT or .tcLogX file specified by the File_name parameter after the test run is over.

    Notes:

    • Important: File_name should specify the name of a non-existent file. If it specifies an existing file, TestComplete will fail to run the test.

    • It is recommended that File_name specify the fully qualified file name. If the parameter value does not include the folder path, TestComplete will save the file to the current TestComplete folder (by default, it is the project folder).

    For more information on exporting test results with TestComplete, see Exporting Results From the Command Line.

  • /ExportLogToXMLAlso - When you command TestComplete to export results in the Unpacked Storage format, it generates JSON data files and HTML, CSS, images, and other helper files. Using this argument in the command line tells TestComplete to generate data files in the XML format in addition to the JSON data files. See Exporting Test Results in TestComplete.

  • /exit (or /e) - If this argument is used along with the /run argument, TestComplete will close after the project (or project suite) run is over. If the /exit command-line argument is used without /run, then neither the specified project (project) suite will be run, nor will TestComplete be closed.

    Note that if you run tests, the project (or project suite) file will be changed because it will contain a reference to the new log file. TestComplete will display the Confirm dialog asking you to save the changes. To suppress displaying the dialog on exit, specify the /SilentMode command-line argument along with /exit.

  • /SilentMode - If this argument is specified, TestComplete works in Silent mode, that is, it neither displays dialogs, nor informs you about errors or warnings. The dialogs and messages to be displayed are handled as if you pressed the default button in them. Information about these dialogs and messages is posted to Silent.log file to the <System_Drive>:\Documents and Settings\<UserName>\Application Data\SmartBear\TestComplete\12.0 folder on Windows XP and Windows Server 2003 and to the <System_Drive>:\Users\<UserName>\AppData\Roaming\SmartBear\TestComplete\12.0 folder on Windows Vista, Windows 7, Windows Server 2008 and later operating systems (the file must not be read-only or locked by another application). The errors that occur during the test execution are posted to the test log.

    If TestComplete is running in Silent mode, it does not press the default button in the window asking if the user wants to convert the project created in earlier TestComplete versions to the new format. This was done to prevent users from accidental project conversion. To force TestComplete to convert such a project automatically, use the /ForceConversion command-line argument.

    If TestComplete running in Silent mode is integrated into a source control system, it tries to enable the batch mode for the source control system. This mode allows working with the source control system without displaying dialogs and messages invoked by the source control system provider. If the source control system does not support the batch mode, TestComplete disables source control integration support. For more information, see Working With Source Control Systems in Silent Mode.

  • /ErrorLog:File_name - Commands TestComplete to save the description of the error that does not allow opening the project or running the test to the text file specified by the File_name parameter.

    Notes:

    • This argument can be used only with the /SilentMode argument (see above).

    • File_name should specify a non-existent file. If you specify the name of an existing file, TestComplete will fail to run the test.

    • It is recommended that File_name specify the fully qualified file name. If the parameter value does not include the folder path, TestComplete will save the file to the current TestComplete folder (by default, it is the project folder).

  • /ForceConversion - If this argument is specified and TestComplete is running in Silent mode, TestComplete automatically converts projects created in earlier versions of the tool to the new format when they are opened.

    Notes:

  • /Timeout:time_in_seconds - Timeout for the TestComplete session in seconds. This timeout includes both the TestComplete startup time and the test run time. If TestComplete is still running when the timeout elapses, it posts an error to the test log (if a test is running) and closes. See also Stopping Tests on Timeout.

    Possible values are 30 .. 4 294 967 seconds (49.7 days). If the specified value is out of range, the closest in-range value is used.

  • /ns - Opens TestComplete without displaying the splash screen.

  • /agpatcheroff - Disables Silverlight auto-patching.

  • /install:extension_name (or /ip:extension_name) - Installs the specified TestComplete plugin and enables it on the product start. The extension_name parameter specifies the fully-qualified name of the desired plugin file (.pls). This command may help you customize a testing environment on remote computers according your needs.

    Notes:

    • If the name of the plugin file includes spaces, it must be enclosed in double quotes:

      "TestComplete.exe" /install:"C:\TestComplete plugins\plugin.pls"
    • You can install only one plugin at a time.

    • When you use the command line to load a project, the specified plugin will be installed before the project is opened.

    • You cannot use this command-line argument to install script extensions.

  • /uninstall:extension_name (or /up:extension_name) - Uninstalls the specified TestComplete plugin on the product start. The extension_name parameter specifies the fully-qualified name of the plugin file (.pls). This command may help you customize a testing environment on remote computers according your needs.

    Notes:

    • If the name of the plugin file includes spaces, it must be enclosed in double quotes:

      "TestComplete.exe" /uninstall:"C:\TestComplete plugins\plugin.pls"
    • You can uninstall only one plugin at a time.

    • This command will not delete the actual file from the disk.

    • When you use the command line to load a project, the specified plugin will be uninstalled before the project is opened.

    • You cannot use this command-line argument to uninstall script extensions.

  • /RestServerPort:port - The port used by the TestComplete RESTful service that is provided by the REST API plugin. The default port is 2377. Make sure this port is allowed through your firewall or antivirus.

Remarks
  • You can determine what parameters were passed to TestComplete in its command line by using the ParamStr function. It allows you to get a TestComplete command-line argument specified by its index. To get the total number of arguments in the command line, use the ParamCount function.

    The following code demonstrates how you can determine command-line arguments:

    JavaScript, JScript

    function CommandLineArgs()
    {
      var i;
      var nArgs = BuiltIn.ParamCount();
      Log.Message("Total number of command-line arguments: " + nArgs);
      Log.Message("The fully-qualified name of the TestComplete executable: " + BuiltIn.ParamStr(0));

      for (i = 1; i <= nArgs ; i++)
        Log.Message("Arg " + i + ": " + BuiltIn.ParamStr(i));
    }

    Python

    def CommandLineArgs():
      nArgs = BuiltIn.ParamCount();
      Log.Message("Total number of command-line arguments: " + nArgs);
      Log.Message("The fully-qualified name of the TestComplete executable: " + BuiltIn.ParamStr(0));
      for i in range (1, nArgs):
        Log.Message("Arg " + i + ": " + BuiltIn.ParamStr(i));

    VBScript

    Sub CommandLineArgs
      Dim nArgs, i

      nArgs = BuiltIn.ParamCount
      Log.Message "Total number of command-line arguments: " & nArgs
      Log.Message "The fully-qualified name of the TestComplete executable: " & BuiltIn.ParamStr(0)

      For i = 1 To nArgs
        Log.Message "Arg " & i & ": " & BuiltIn.ParamStr(i)
      Next
    End Sub

    DelphiScript

    procedure CommandLineArgs;
    var nArgs, i;
    begin
      nArgs := BuiltIn.ParamCount;
      Log.Message('Total number of command-line arguments: ' + VarToStr(nArgs));
      Log.Message('The fully-qualified name of the TestComplete executable: ' + BuiltIn.ParamStr(0));

      for i := 1 to nArgs do
        Log.Message('Arg ' + VarToStr(i) + ': ' + BuiltIn.ParamStr(i));
    end;

    C++Script, C#Script

    function CommandLineArgs()
    {
      var nArgs = BuiltIn["ParamCount"]();
      Log["Message"]("Total number of command-line arguments: " + nArgs);
      Log["Message"]("The fully-qualified name of the TestComplete executable: " + BuiltIn["ParamStr"](0));

      for (var i = 1; i <= nArgs ; i++)
        Log["Message"]("Arg " + i + ": " + BuiltIn["ParamStr"](i));
    }

  • It is not recommended to launch TestComplete using the runas command, since this significantly slows down the test execution.

Examples

Below are several examples of running TestComplete via the command line.

Note: The sample command lines below may split into two or more lines. This is a visual effect that depends on the width of the help viewer’s window. When specifying a command line for TestComplete, type all command-line arguments into the same line.
  • The following command runs TestComplete, loads the specified project suite (MySuite.pjs) and tells TestComplete to execute test items of the MyProj project:

    "C:\Program Files\SmartBear\TestComplete 12\Bin\TestComplete.exe" "C:\My Projects\MySuite.pjs" /r /p:MyProj

  • The following command runs TestComplete, loads the specified project suite (MySuite.pjs) and tells TestComplete to execute all projects that are enabled. TestComplete waits until the run is over and then gets closed.

    "C:\Program Files\SmartBear\TestComplete 12\Bin\TestComplete.exe" "C:\Work\My Projects\MySuite.pjs" /r /e

  • The following command runs TestComplete, loads the specified project suite (MySuite.pjs) and tells TestComplete to run the tests associated with the NetworkSuite project item of the MyTest project:

    "C:\Program Files\SmartBear\TestComplete 12\Bin\TestComplete.exe" "C:\Work\My Projects\MySuite.pjs" /r /p:MyTest /pi:NetworkSuite

  • The following command runs TestComplete, loads the specified project suite (MySuite.pjs) and tells TestComplete to execute the Test1 keyword test of the MyProj project:

    "C:\Program Files\SmartBear\TestComplete 12\Bin\TestComplete.exe" "C:\Work\My Projects\MySuite.pjs" /r /p:MyProj /t:"KeywordTests|Test1"

  • The following command runs TestComplete, loads the specified project suite (MySuite.pjs) and tells TestComplete to run the Main script routine located in the Unit1 unit of the MyProj project:

    "C:\Program Files\SmartBear\TestComplete 12\Bin\TestComplete.exe" "C:\Work\My Projects\MySuite.pjs" /r /p:MyProj /u:Unit1 /rt:Main

    -- or --

    "C:\Program Files\SmartBear\TestComplete 12\Bin\TestComplete.exe" "C:\Work\My Projects\MySuite.pjs" /r /p:MyProj /t:"Script|Unit1|Main"

  • The following command runs TestComplete, loads the MySuite.pjs project suite and commands TestComplete to run the Task1 task of the network suite’s Job1 job in the MyProj project:

    "C:\Program Files\SmartBear\TestComplete 12\Bin\TestComplete.exe" "C:\Work\My Projects\MySuite.pjs" /r /p:MyProj /t:"NetworkSuite|Jobs|Job1|Task1"

  • The following command runs TestComplete, loads the MySuite.pjs project suite and commands TestComplete to run the Job1 job in the MyProj project’s network suite:

    "C:\Program Files\SmartBear\TestComplete 12\Bin\TestComplete.exe" "C:\Work\My Projects\MySuite.pjs" /r /p:MyProj /t:"NetworkSuite|Jobs|Job1|Job1"

    The name of the Jobs collection is the same as the job’s name (Job1).

Note that TestComplete waits until the specified project suite, project, test and so on is executed in all the examples above. However, the command line is ready to receive new commands right after TestComplete has been launched.

If you want the command line to wait until the test (project and so on) execution is over, you can use the START command as shown in the example below:

start "My Title" /wait "C:\Program Files\SmartBear\TestComplete 12\Bin\TestComplete.exe" "C:\Work\My Projects\MySuite.pjs" /run /exit /SilentMode

Pay attention to the string after the START command in the example above. It is the title of the command-line window and it is needed for the command to work correctly.
See also
TestComplete Exit Codes | Scheduling Automated Tests


© 2016 SmartBear Software. All rights reserved.
Email Send feedback on this document