HOW TO: Associate Automation for Test Cases in Visual Studio 2010

 

In 2010 version of Visual Studio one can author Test Cases and associate to the Test Cases automation if one had implemented them. While most of the Test Planning, Test Authoring etc.,. can be done from within Microsoft Test Manager (aka MTM) 2010 itself, one cannot associate automation to Test Cases from within the MTM Console itself.

image

 

One can always “Remove” the Associated Automation from MTM though. See the Remove Association button below when you open a specific Automated Test Case.

image

To associate Automation to Test Cases one has to do it from Visual Studio IDE. This is by design.

This is quite natural if you see, where the Automation (ie primarily the code responsible for Automation) is usually developed. The Automation is usually done as follows from the Visual Studio IDE and not from MTM.

a) Convert Recorded Tests into Coded UI
b) Generate Coded UI Directly from the VS (Right Mouse on a Test Project and Click Add)
c) OR as any of the other test types shown above such as Unit Tests, to Generic Tests.

 

image

 

The Automation is developed in the Visual Studio IDE. So once the Test Case is fully authored in MTM, and then saved, it gets created as a Work Item in TFS. You will then have to come to the Visual Studio IDE and open the Work Item as follows (Typically by pulling up the Work Items Node from Team Explorer and running a query to get Work Items of Type “Test Case”).

image

In the above I have used the “My Test Cases” Work Item query. Once you get the results you can go to the Test Case of interest and pull up the “Associated Automation” tab and associate the automation you developed as shown below. To do this click on the ellipses button ( … ) on the right of entry for Automated Test Name.

image

Once you do that you would be able to the see the list of possible Tests that you authored/developed in VS IDE and select from the list the appropriate test that you want to be used as the automation for the Test Case that was authored from MTM. This is therefore by design, if you wondered why you were not able to do the same – ie “Associate Automation” from the MTM.

Not directly related to the topic at hand, it is worth exploring the “TCM.EXE” tool. I am just providing the details of the TCM help screen.

image