The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

tcm: Listing test plans, test suites, test configurations, and environments


To run your tests from the command line using tcm.exe or to import your test cases into a specific test suite, you need the names and the IDs of the artifacts that are required to run the tests. You can get a list of test artifacts from the command line by using the following tcm commands:

  • tcm plans /list

  • tcm suites /list

  • tcm configs /list

  • tcm testenvironments /list

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

tcm plans /list [/querytext:query] /collection:CollectionURL /teamproject:project [/login:username,[password]]  

tcm suites /list [/planid: id | /querytext:query] /collection:CollectionURL /teamproject:project [/login:username,[password]]  

tcm configs /list [/querytext:query] /collection:CollectionURL /teamproject:project [/login:username,[password]]  

tcm testenvironments /list /collection:CollectionURL /teamproject:project [/login:username,[password]]  


/querytext:querySpecifies the query to use to return the test artifacts.
/planid:idSpecifies that only the test suites in this test plan will be listed.
/collection:CollectionURLSpecifies the URI of the team project collection. The format for the URI is as follows: http://ServerName:Port/VirtualDirectoryName/CollectionName

If no virtual directory is used, then the format for the URI is as follows:

/teamproject:projectThe name of the team project that contains the test plan that you want to import your automated tests into.
/login:username,[password]Optional. Specifies the name and password of a user who is logged on to the application-tier server for Team Foundation Server and who has permissions to run the command. You would use this option if your Windows credentials do not have the appropriate permissions, or you are using basic authentication, or you are not connected to a domain.

To login to Visual Studio Team Services, you will also need to use /allowalternatecredentials listed below.
/allowalternatecredentialsThis flag must be specified in addition to the /login parameter when connecting to Visual Studio Team Services. (This flag is only available if you have Visual Studio 2013 Update 4 or greater.)

You can add parameters for /collection and /teamproject to the tcm.exe.config XML file which is located in the same directory as tcm.exe: <Drive:>\Program Files\Microsoft Visual Studio 11.0\Common7\IDE. If you add these to the file, you do not need to have them on the command line each time you run a tcm command. You can add these keys and their values to the file, as follows, in the appSettings section:

     <add key="TeamFoundationServer" value=""http://<ServerName:Port/VirtualDirectoryName/CollectionName>"/>  
     <add key ="TeamProject" value="DinnerNow"/>  

The following examples assume that you have started a Visual Studio command prompt.

To do this, choose Start, point to All Programs, point to Microsoft Visual Studio 2012, point to Visual Studio Tools, and then choose Developer Command Prompt.

The command prompt opens to the folder: <drive>:\Program Files\Microsoft Visual Studio 11.0\VC

The following command lists the test configurations in the DinnerNow team project:

tcm configs /list /collection:http://<Team Foundation Server Name>:8080/tfs/<team project collection name>  

The following command lists only the test plan Sprint 1 in the DinnerNow team project so that you can view its ID:

tcm plans /list /querytext:"SELECT * FROM TestPlan WHERE PlanName=’Sprint 1’" /collection:http://<Team Foundation Server Name>:8080/tfs/<team project collection name>  

The following command lists the test suites in the test plan with ID 3 in the DinnerNow team project:

tcm suites /list /planid:3 /collection:http://<Team Foundation Server Name>:8080/tfs/<team project collection name>  

tcm: Running Tests from a Test Plan Using the Command Line Utility
Using tcm to import and run automated tests for a test plan from the command line