This documentation is archived and is not being maintained.

tcm: Importing and Running Automated Tests for a Test Plan from the Command Line

Tcm.exe is a command-line utility that lets you perform the following tasks:

  • Import automated tests into a test plan

  • Run tests that are part of a test plan from the command line

  • View a list of test items and their corresponding IDs to use when you import tests or run tests

For more information about how to create test plans, see Defining Your Testing Effort Using Test Plans.

tcm.exe is located in <Drive:>\Program Files\Microsoft Visual Studio 11.0\Common7\IDE on any machine that has Visual Studio Ultimate, Visual Studio Premium, or Visual Studio Test Professional installed.

You can use the following parameters to display Help text for tcm.






Displays the syntax and parameters for the tcm command-line tool.

command /help


command /?

Displays the syntax and parameters for the tcm command that you specify.


Associated Topics

Importing Automated Tests: If you have created automated tests using Visual Studio, you might want to run these tests as part of a test plan. By adding them to a test plan, you can measure your testing progress. You can associate these tests with requirements or user stories. In addition, you can view the results from these automated tests and any other tests in your test plan together and track the progress that you are making. You can also analyze the results every time that you run these tests using Microsoft Test Manager.

Tcm.exe provides an easy way to import automated tests from a test assembly and associate them with test cases using the following syntax:

tcm testcase /import

Running Tests that are Part of a Test Plan from the Command Line: You can run test cases with associated automation from the command line using tcm.exe instead of using the user interface provided by Microsoft Test Manager. This enables you to start runs automatically from a batch file. For example, you can then decide to schedule that batch file to run every time that a build is completed.

Use the following command to run tests using tcm.exe:

tcm run

You can also manage test runs, export test results and publish test results to a test plan using tcm run.

Viewing a List of Test Items: To import tests or run tests using tcm.exe, you have to provide the IDs for certain test items. You can view a list of these items and their IDs using commands that are part of tcm.exe.

For example, to view test suites use the following command:

tcm suites /list

Importing or Exporting Mappings to a Bug Field: You can create a bug when a tester finds a code defect when using Microsoft Test Manager. The tcm command-line utility supports the import and export of a mapping file to the team project. The mapping file defines the type of work item to create when the user takes this action and the three data fields to be filled in by Microsoft Test Manager. The three fields are test steps, system information, and the build in which the defect was found. When testers run a test and find a defect, they can create a bug in which the three fields are filled in automatically.