Associating a TFS test case with a test method

Association creates a linkage between a TFS test case and a test method in Visual Studio. You can link any unit test, coded UI test, or generic test to an TFS test case.

In this example, a coded UI test project (CUIT) is linked to a TFS test case by means of the following steps:

  1. Start Microsoft Visual Studio.
  2. Open your project, created in the previous topic, and then choose a test method.
  3. Check in your test method on the TFS server.
    1. In Solution Explorer, right-click your solution and then click Check In.
    2. In the Check In dialog box, type an appropriate comment, and then click Check In. Visual Studio will check in the solution files to the Team Foundation source control.
  4. Build/rebuild your project to compile all project files and components that have changed since the most recent build.
    1. In Solution Explorer, choose or open the project.
    2. On the menu bar, choose Build, and then choose either Build [ProjectName] or Rebuild [ProjectName].
  5. In Visual Studio, open the TFS test case to be associated with the test method.

  6. Associate the test method with the test case.
    1. Next to the Automated test name box, click the ellipsis (...) button to add the automated test method to the test case.
    2. In the Choose Test dialog box, select the test method to associate with the test case, and then click OK.

Once the association is complete, in the Associated Automation tab of the TFS test case, you see the following: