Visual Studio 2012, “Create Unit Tests” context menu item missing.

The latest contract I’m working on has me writing some unit tests for some legacy code. Someone had previously built an MS Test project for most of what I’ve been working on, using the handy “Create Unit Tests…” context menu item in Visual Studio 2010, which stubs out unit tests for methods in your code.

Once I had exhausted the list of auto-generated unit test methods and moved onto a project where no one had previously generated tests, I went looking for this generation method myself. Strangely enough, I found it missing.

It took me a while to poke around on the web and find a couple of different solutions, but the best post I was able to find on the subject is here (Firedancer Unleashed blog), wherein she describes exactly how to get the full functionality of that context-menu command, including the context-menu entry itself, back up and running.

Pay special attention to the “Caveats!” section near the bottom; she describes how to get the functionality working if you are getting errors or see the entry but it’s disabled. In my case, I had already added a Unit Test project to my solution and had already added classes for some tests, but apparently you have to add a “Unit Test” via the Add > New Item method before this option will be available.

Check it out and enjoy.

This entry was posted in Uncategorized. Bookmark the permalink.

One Response to Visual Studio 2012, “Create Unit Tests” context menu item missing.

  1. faalon says:

    Just as an FYI, I have checked this functionality in Visual Studio 2013, and it appears they have removed the entry “Create Unit Tests” from the context menu completely now, so this is not an option any longer. Hopefully they have/will replace it with something equally useful instead of just getting rid of the functionality completely.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s