Sdílet prostřednictvím


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 10.0\Common7\IDE on any machine that has Visual Studio Ultimate installed.

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]]

Parameters

Parameter

Description

/querytext:query

Specifies the query to use to return the test artifacts.

/planid:id

Specifies that only the test suites in this test plan will be listed.

/collection:CollectionURL

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

http://ServerName:Port/CollectionName

/teamproject:project

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

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

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

List Test Items

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

To do this, click Start, point to All Programs, point to Microsoft Visual Studio 2010, point to Visual Studio Tools, and then click Visual Studio Command Prompt (2010).

The command prompt opens to the folder: <drive>:\Program Files\Microsoft Visual Studio 10.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>
/teamproject:DinnerNow

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 TestPlans WHERE PlanName=’Sprint 1’" /collection:http://<Team Foundation Server Name>:8080/tfs/<team project collection name>
/teamproject:DinnerNow

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>
/teamproject:DinnerNow

See Also

Reference

tcm: Running Tests from a Test Plan Using the Command Line Utility

Other Resources

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