[Collapse]TestComplete/viewarticle/63445/
 [Expand]General Information/viewarticle/63445/
 [Expand]Using Help System/viewarticle/55799/
 [Expand]Getting Started Tutorial/viewarticle/56246/
 [Collapse]Using TestComplete/viewarticle/57875/
  [Expand]TestComplete User Interface, Projects and Settings/viewarticle/57876/
  [Expand]Creating, Recording and Running Tests/viewarticle/56646/
  [Expand]Test Results/viewarticle/55010/
  [Expand]Enhancing Tests/viewarticle/56964/
  [Expand]Teamwork and Integration Into QA Process/viewarticle/57266/
  [Expand]Extending TestComplete/viewarticle/57655/
  [Collapse]Automating TestComplete/viewarticle/57438/
   [Collapse]Command Line and Exit Codes/viewarticle/57437/
     TestComplete Command Line/viewarticle/55587/
     TestComplete Exit Codes/viewarticle/56560/
   [Expand]Working With TestComplete via COM/viewarticle/57456/
   TestComplete Tips/viewarticle/57877/
 [Expand]Testing Types/viewarticle/62721/
 [Expand]Applications Testing/viewarticle/62606/
 [Expand]Working With Application Objects and Controls/viewarticle/55815/
 [Expand]Samples and Tutorials/viewarticle/56239/
 [Expand]References/viewarticle/57878/
 [Expand]Other Tools That Help You Test Better/viewarticle/63442/
 [Expand]TestComplete 10 Licensing Guide/viewarticle/63451/
Updated: 4/23/2014 Applies To: TestComplete 10 Rating: No votes Click to rate: PoorNot badAverageGoodExcellent
Command-Line Arguments and Exit Codes Select language for code samples Select language for code samples

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] [/exit]]
[/SilentMode [/ErrorLog:File_name] [/ForceConversion]] ]
[Timeout:Time_in_seconds] [/ns] [/agpatcheroff]

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 and ODT project items.

    /project:project_name  /test:test_name

    TestComplete will run the specified test. This can be any element that TestComplete can execute: a keyword test, a script routine, a low-level procedure, a manual test, a network suite, and so on.

    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 test name, the name of the parent project item and, for scripts, the name of the unit, which are separated by the pipe character ( | ) and enclosed in quotation marks. For example, "KeywordTests|Test1", "LLCollection1|LLP1" or "Script|Unit1|Main".

    Note: Make sure that the specified manual test has at least one step to run. Otherwise an error will occur.

    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.

  • /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\10.0 folder on Windows XP and Windows Server 2003 and to the <System_Drive>:\Users\<UserName>\AppData\Roaming\SmartBear\TestComplete\10.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 - This argument specifies a timeout for a TestComplete run. When the time specified by Time_in_seconds elapses, TestComplete posts an error message to the log of the test that is running at the moment (if any) and closes. Minimum timeout value is 30 seconds. If you specify a lower value, 30 seconds is set instead. See also Terminating Tests on Timeout.

    Note: When specifying the timeout value, take into account the time it takes for TestComplete to launch and the time it takes for the specified test to execute.
  • /ns - Opens TestComplete without displaying the splash screen.
  • /agpatcheroff - disables Silverlight auto-patching.
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:

    Show Example

  • 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 10\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 10\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 10\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 10\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 10\Bin\TestComplete.exe" "C:\Work\My Projects\MySuite.pjs" /r /p:MyProj /u:Unit1 /rt:Main

    -- or --

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

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, for example.

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

See also
TestComplete Exit Codes | Scheduling TestComplete Runs


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