Command Line Interfaces are often preferred by many users, as they provide a more concise and powerful means to control a system or application. Also the applications with command-line interfaces are often much easier to automate via scripting.

command-line copy

A command-line interface (CLI) is a means of interaction with a computer program where the user (or client) issues commands to a program in the form of successive lines of text (command lines).

Automating TestComplete becomes very easy via its Command-line interface. This is very simple and below are the ways to run it

TestComplete.exe file_name /run /project:project_name

file_name : Launches TestComplete and loads the specified project

/run (/r) – Commands TestComplete to execute tests provided by the project specified by the file_name argument.

/project (/p):project_name – Project_name is the name of the project. This will execute only those test items that are selected on the Test Items page. The unselected items are not run.

TestComplete.exe "C:\TC\Example\SampleTest.pjs" /r /p:SampleTest

 

TestComplete.exe file_name /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. only those project items that have the Run item in their context menu can be run in this case.

TestComplete.exe "C:\TC\Example\SampleTest.pjs" /r /p:SampleTest /pi:HelloWorld

Note : Test items are those which are displayed on the Test Items page of the project editor. Project items are project elements that are shown in the Project Explorer panel.

 

TestComplete.exe file_name /run /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.

TestComplete.exe "C:\TC\Example\SampleTest.pjs" /r /p:SampleTest /t:"KeywordTests|Test1"

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

 

TestComplete.exe file_name /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.

TestComplete.exe "C:\TC\Example\SampleTest.pjs" /r /p:SampleTest /u:Unit1 /rt:Test

No /project, /unit or /routine arguments specified. TestComplete will run the tests provided by the opened project suite.

See also  Get Scripting Access - the Flash Injector way

 

/exit ( /e) – TestComplete will close after the project (or project suite) run is over, should be used with /run argument.

TestComplete.exe "C:\TC\Example\SampleTest.pjs" /r /e

This will execute all the projects that are enabled, waits until the execution is over and then TestComplete gets closed.

/SilentMode – If this argument is specified, TestComplete works in Silent mode, that is, it neither displays dialogs, nor informs you about errors or warnings.

TestComplete.exe "C:\TC\Example\SampleTest.pjs" /run /exit /SilentMode

/exportlog:File_name (or /el:File_name) – Exports the test run results to the .mht file specified by the File_name parameter.

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

/ns – Opens TestComplete without displaying the splash screen.

7 COMMENTS

  1. can i pass complete project path here “TestComplete.exe file_name /run /project:project_name /projectitem:item_name” because by projects are stored in a seperate folder in the project suite

    • You will need to read the files in the folder, check for the ‘pjs’ files and use any of the option above to execute in TestComplete. below is the code snippet you can use in VBS to read the files

      Set objFSO = CreateObject("Scripting.FileSystemObject")
      sFolder = "C:\Scripts" 'mention your folder path here'
      
      Set objFolder = objFSO.GetFolder(sFolder )
      
      Set colFiles = objFolder.Files
      For Each objFile in colFiles
          msgbox objFile.Name ' use the command here to run
      Next

      hope this is what you are looking for, if not please elaborate.

  2. […] TestComplete is also a COM Server and its different methods and properties are exposed by its COM interface which can be accessed by other applications and scripting tools to control it from outside. In this post, we will see how to interact with TestComplete from outside via COM. However there are other ways as well to interact with TestComplete, which we will discuss in another post for TestComplete : Command Line. […]

  3. my project is in shared netwrok , not sure how to pass the folder directory , saying the project suite was not found

    “\\me-sys2\qa\Automation\Projects\Testing_Suite\Testing_Suite.pjs\” /run /project:DataMigration

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.