Associating TA and TFS test cases

To execute TestArchitect test cases from MTM, an association must be created in the related Visual Studio project.

Ensure that you have already taken the following step(s):
Running TA tests from MTM requires two types of associations:
  1. Start Visual Studio.
  2. Right-click a project, and then select Associate.
    Fastpath: Alternatively, click the Generate and Associate Test Method from TestArchitect button on the Visual Studio toolbar.
    Note: If the Generate and Associate Test Method from TestArchitect button is not visible on the Visual Studio toolbar, enable the button by right-clicking on the toolbar and selecting TestArchitect from the context menu.
  3. In the Connect to Team Foundation Server dialog box, select the server to connect to from the Team Foundation Server drop-down box, and then choose the correct team project values for Team Project Collections and Team Projects. Click Connect to establish an association between TFS and TestArchitect.

  4. In the Select Test Plan dialog box, choose a test plan, then click Select plan to proceed.



  5. In the Select Tests dialog box, select the test suites and test cases to associate with the tests. Tests which have been associated previously are selected automatically. After you finish selecting the desired tests, click Associate.

    Tip: In this dialog box, you can select Filter to narrow down the list of test cases displayed based on the selected conditions.
    A confirmation dialog box appears, letting you know that the association was successful.

  6. Click OK to close the dialog box.
    • Test methods are generated in the project as follows:

    • In MTM, information on the association is added into test cases as follows:

  7. Check in the solution to save the associated data by doing the following:
    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.
Microsoft Visual Studio automatically generates C# code snippets which associate the TestArchitect test cases with the TFS test cases. You normally do not need to edit the generated snippets. However, you should verify that the test case IDs for each test method match the associated IDs.



In the above example, three C# test methods have been generated (one method for each test case) for the three TestArchitect test cases (TC01, TC02, and TC03). Each method consists of a call to RunTestCase, which starts the execution of the TestArchitect test case whose source field maps to the TFS test cases with identifiers 1, 4, and 5 respectively.
Important: This task is one that must often be repeated, especially when you have modified mapped TFS test cases. (For example, you remove or add test cases, or change the order of a test case run.) When you do so, the association between TFS test cases and Visual Studio test methods/TestArchitect test cases is compromised. Hence, it is necessary that you perform the following steps again:
  1. Re-associate TestArchitect test cases with TFS test cases.
  2. Check in your project.
  3. Queue the build.