Partager via


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

Comments

  • Anonymous
    July 26, 2011
    The comment has been removed

  • Anonymous
    July 27, 2011
    Hello Prashant, Please check this MSDN article for overview of Generic Tests. msdn.microsoft.com/.../ms182623.aspx. Once you understand that, you can create generic tests. These could then be part of the Test Cases and Test Scenarios you use in the Test Case Management tool  which we call MTM (Microsoft Test Manager). Regarding not associating it to any Team Build, you can always use a dummy build definition you create and then do the association against it there, if your situation is that you dont have any build to work against. But the way the MTM works AFAIK, you have to specify a Team Build for the publish to haoppen as all Test Results are stored in the TFS databases associated to a build. -Girish.

  • Anonymous
    November 07, 2011
    For what it's worth, it would be really nice if it were possible to associate more than one automated test case with a TFS Test Case - the number of variations (say, in making a call to a web api) can make authoring a separate test case per variation prohibitively cumbersome - in my situation the variations we expect to test are listed in the body of the TFS test case, and I would really like to be able to attach all the automated test cases that apply to that 'abstract' or 'template' TFS Test Case for tracking scenario completion

  • Anonymous
    December 21, 2011
    Hello, How come I do not see any tests in "Choose Test" window? I have a solution opened from TFS, and it got a number of test projects. I was able to successfully built them and have the dlls created. But, when I clicked the ellipses (...) in the Associate Automation, I don't see any tests. But, my collegue can see them!!! Thanks, Vijay

  • Anonymous
    January 27, 2014
    Hello, How come I do not see any tests in "Choose Test" window? I have a solution opened from TFS, and it got a number of test projects. I was able to successfully built them and have the dlls created. But, when I clicked the ellipses (...) in the Associate Automation, I don't see any tests. But, my collegue can see them!!! Thanks, Vijay

  • Anonymous
    July 08, 2015
    I am not able to see any tests on choose test window.. how do i resolve that?

  • Anonymous
    July 14, 2015
    Hi can i have a web test case , It has to run in three browsers individually . So for one manual test case i have three test methods.TC_test_ff,TC_test_chrome,TC_test_IE for TC_test methd so now i have one manual test case for this . Can i associate multiple test methods to a single test case ? is it possible ? if so how i can do that ? Kindly help me with this.

  • Anonymous
    November 03, 2015
    Hi, if we know the test method Name for eg: MyTestMethod1 which got associated to multiple test cases in MTM, is there any simple way to get the test cases which got associated with that particular test method .? Thanks in Advance.