Visual Studio 2010 and Team Foundation Server 2010 opens up many scenarios in Test management. Many of the important workflows starts off by associating a test-case entity ( in TFS ) with any unit-tests ( can be Coded UI Test, Unit test and etc., ). Creation or Editing of a test-case can be done from Microsoft Test and Lab Manager (MTLM) from the “Testing Center” tab.

However, it is not possible to associate the test-case with the test-method from Microsoft Test and Lab Manager (MTLM). When viewing the “Associated Automation“ tab in any test-case, we can notice all the entries are read-only. This linking can be done from Visual Studio IDE.

Snapshot of Test-case opened in Microsoft Test and Lab ManagerTCM_TC

Steps to associate a Test-method with a Test-case:

1. Open the Visual Studio IDE.

2. Open the test-project or solution in which the needed test-method to be associated.

3. Connect to the required TFS Project Collection and then the Team Project.

4. Query for the needed test-case using Id / Owner / Created data and so on.

5. Open the required test-case and click on “Associated Automation” tab

6. Click on the ellipses near the “Automated Test Name”

7. In the “Choose Test” dialog, Choose the required test method and Click on “Ok”. This dialog only shows the list of tests that are part of currently loaded test project or solution.

Snapshot of Test-case opened in Visual Studio IDEVS_TC