TestComplete Command Line

Applies to TestComplete 12.60, last modified on September 17, 2018

Command-Line Syntax

In general, the TestComplete command line is as follows:

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.

Note that TestComplete has two executables for 32-bit and 64-bit:

  • The TestComplete 32-bit executable is located in the <TestComplete>\Bin folder.

  • The TestComplete 64-bit executable is located in the <TestComplete>\x64\Bin folder.

Command-Line Arguments

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. You can view the list of test items on the Test Items page of the project.

TestComplete will run only the enabled test items, it will not run the disabled items.

Note: Do not confuse test items with project items. Test items are a sequence of tests to run that you specify on the Test Items page of your project. Project items are elements that belong to your project (for instance, a keyword test) and that you can view in Project Explorer.
/project:project_name  /projectitem:item_name

TestComplete will run test(s) provided by the specified project item. You can view project items in the Project Explorer panel. Project_name is the name of the project as it is 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. 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: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 ReadyAPI test

  • A test item you specify on the View > Organize Tests page of the project editor

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:

  • For project items, the full name includes the name of the collection, to which the item belongs, and the item name 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.

    Do not include the Advanced folder of other logical project folders to the test full name.

    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"

  • For test items, the full name is specified according to the item hierarchy on the View | Organize Tests page, including parent test items and groups. Enclose the test full names in quotation marks.

    For example:

    "ProjectTestItem1"

    "ProjectTestItem1|ProjectChildTestItem1"

    "Group1|ProjectTestItem1"

Note: TestComplete executes only those test items that are enabled on the Test Items page. The disabled items are not run.
/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.

/cbt

TestComplete will run tests in CrossBrowserTesting environments.

TestComplete must have access to the CrossBrowserTesting cloud, and your project suite must include configured environments and tests assigned to them. To learn more, see Integration With CrossBrowserTesting.com.

If TestComplete does not have account information required to connect to CrossBrowserTesting, it will show a dialog suggesting that you specify the needed information. If you run TestComplete in Silent mode and no account data is available, TestComplete will not run tests and post an error message to Silent.log.

Notes:

  • To set a timeout for your CrossBrowserTesting test run, use the /timeout argument. Set a greater timeout value because the timeout will include not only the test run time, but also the startup time of CrossBrowserTesting environments. See below.

  • You can initiate test runs in CrossBrowserTesting environments only from TestComplete. TestExecute does not support running tests in CrossBrowserTesting environments.

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 a file specified by the file_name parameter after the test run is over.

Notes:

  • 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 exported results, TestComplete supports the following file extensions:

    • .mht
    • .tcLogX
    • .html
    • .htm

For more information on exporting test results with TestComplete, see Exporting Test Results in TestComplete.

/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.

/ErrorLog:file_name

Commands TestComplete to save information on the errors that occurred during the run to the text file the file_name parameter specifies. This file will include information on the errors that occurred in your tests and on the errors that did not allow opening the project or running the test (for example, an incorrect project path).

Notes:

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

  • We recommend 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).

/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: 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.

/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 you run tests in the CrossBrowserTesting cloud, the timeout will also include the startup time of environments.

If a test is still running after the timeout elapses, TestComplete will post an error to the test log and stop the test run. See Stopping Tests on Timeout. All further tests will be canceled. TestComplete will be closed.

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.

/UsageStatistics:File_name (or /US:File_name)

Commands TestComplete to collect statistics on usage of Name Mapping items during test runs. TestComplete will save the gathered data to the specified file. You can then use this data in the Name Mapping editor and remove unused mapping items. See Find and Remove Unused Mapping Items for details.

If the file name includes spaces, enclose it in quotes:

TestComplete.exe /UsageStatistics:"c:\some shared folder\Name Mapping Data.stat"

/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.

/EnableModule:module_set

Available in TestComplete 12.50 and later. Enables or disables available TestComplete modules and add-ons on startup. module_set is the name of the module or add-on to enable, which can be:

  • Desktop

  • Mobile

  • Web

  • Intelligent Quality (or IntelligentQuality, or IQ)

If a module or add-on is not specified, it will be disabled. If the module or add-on name includes spaces, enclose it in double quotes: /EnableModule:"Intelligent Quality".

For example, the following command will run TestComplete with the Desktop and Mobile modules enabled. The Web module and the Intelligent Quality add-on will be disabled:

TestComplete.exe /EnableModule:Desktop /EnableModule:Mobile

The following command will run TestComplete with the Desktop module and the Intelligent Quality add-on enabled. The Web and Mobile modules will be disabled:

TestComplete.exe /EnableModule:Desktop /EnableModule:IQ
Note: If you start TestComplete with this command-line argument, the File > Install Extensions dialog will be disabled.

/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

  • Running TestComplete from the command line is, probably, the easiest way to launch it from third-party tools. This approach is used rather frequently for running TestComplete from continuous integration (CI) systems and custom test frameworks. Note that TestComplete requires an interactive user session for simulating user actions. So, if your CI system or test framework runs TestComplete on a remote machine (typically called an agent or node), this CI system or framework should create an interactive user session for the TestComplete run on that agent (node). For information on how to do this, see the CI system documentation.

  • 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: " + str(nArgs))
      Log.Message("The fully-qualified name of the TestComplete executable: " + BuiltIn.ParamStr(0))
    
      for i in range (1, nArgs+1):
        Log.Message("Arg " + str(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 commands TestComplete to execute test items of the MyProj project:

    TestComplete.exe "C:\My Projects\MySuite.pjs" /r /p:MyProj

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

    TestComplete.exe "C:\Work\My Projects\MySuite.pjs" /r /e

  • The following command runs TestComplete, loads the specified project suite (MySuite.pjs), and commands TestComplete to run the ProjectTestItem3 test item of the MyProj project:

    TestComplete.exe "C:\Work\My Projects\MySuite.pjs" /r /p:MyProj /t:"ProjectTestItem1|ProjectTestItem2|ProjectTestItem3"

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

    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 commands TestComplete to execute the Test1 keyword test of the MyProj project:

    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 commands TestComplete to run the Main script routine located in the Unit1 unit of the MyProj project:

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

    -- or --

    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:

    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:

    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).

  • The following command runs TestComplete, loads the MySuite.pjs project suite, and commands TestComplete to run all the enabled tests assigned to all the enabled CrossBrowserTesting environments in the project suite:

    TestComplete.exe "C:\Work\My Projects\MySuite.pjs" /r /cbt

Note: 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 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

Highlight search results