Associating Automated Tests doesn’t work for Test Cases in Visual Studio

As a developer focused on quality, I write code to test code but from time to time you get into issues that you just don’t understand what is going on more importantly how to fix it. In this case, all I wanted to do is associate a VSO Test Case to an automated test (unit test). I’ve done this in the past many times with success but this one just stumbles me. All of the steps are documented in this article: 

How to: Associate an Automated Test with a Test Case

https://msdn.microsoft.com/en-us/library/dd380741(v=vs.110).aspx

However, the steps are not working for me and all I get when I click on the ellipses is a blank window.

TestWindow

I tried:

  • Cleaning my solution and rebuilding
  • Ensure that my tests have the proper attributes bound. E.g. [TestMethod]
  • Ensured that it’s a managed test project

All of which works. As a last resort, I opened another test project and surprisingly enough I was able to select an automated test. I compared the project file (via text editor) and noticed that my actual test project is missing the projectype xml entry. Now I remember that when I generated my test project, I started off as a class library. I then manually referenced all the VS Unit Testing frameworks, created my unit tests and everything worked fine EXCEPT for associating an automated test to a test case.

The FIX:

Open up your project file in a text editor (Notepad)

Add the following under the <PropertyGroup> node

<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

Save the project file, reload your project and rebuild.

Now you should be able to Associate test cases:

TestWindow1