Associating TestArchitect and Team Foundation Server test cases in Visual Studio

To execute TestArchitect test cases from MTM, an association between TestArchitect tests and Team Foundation Server tests 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 Associate button on the Visual Studio toolbar.
    Note: If the Associate 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 Associate 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:
    • TFS test cases that have not been associated are indicated in GREEN. Whereas, TFS test cases that have been associated are indicated in BLUE. Note that, if you select associated TFS test cases, they will be re-associated.
    • Filtering TFS test cases:
      • In the Associate Tests dialog box, you can select the Filter button to narrow down the list of test cases displayed based on the selected conditions.

      • In the Advanced filter dialog box, by defining one or more clauses, you can filter from work items to return the set of work items that interest you. For more information about query fields, operators, and macros, see here.
      • To temporarily disable the specified filtering conditions, in the Associate Tests dialog box, clear the check box as follows.

      • To remove totally the specified filtering conditions, in the Associate Tests dialog box, click X as follows.

    • If the test association fails due to some reasons, you will see the following error dialog box. Click View Log File to troubleshoot, if needed.

    • If the test association succeeds, a confirmation dialog box appears.

  6. Click OK to exit the confirmation dialog box.
    • Under the TestArchitect_Generated folder, 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.
    Remember: For TFS 2017, you are required to explicitly check in the following DLL LogiGear.TestArchitect.TAIntegrationLoader.dll

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, four C# test methods have been generated (one method for each test case) for the four TestArchitect test cases (TC01, TC02, TC03, and TC04). 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 703, 704, 705, and 706 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.