Update: If you are having issues with the “Create Unit Tests…” function being disabled, check out this post.
If you have followed from my previous workaround to enable “Create Unit Tests…”, you might be delighted that there’s a permanent solution to this issue.
There are two ways to fully enable “Create Unit Tests…” on Visual Studio 2012 without using keyboard shortcuts or command window. Better still, you can now right click –> Create Unit Tests… as could be seen below:
There are two ways to enable this, the elegant way or the abnormal way.
Solution 1: The Elegant Way
This solution is rather easy. All you need to do is just download the vssettings file below and add it into settings. Follow these steps:
- Download the following file: CreateUnitTest.vssettings
- Go to Visual Studio 2012, select TOOLS –> Import and Export Settings.
- Select “Import selected environment settings” and click Next button.
- Then select “Yes, save my current settings” and click Next button. This step will allow you to restore back to your original setting if you made a mistake.
- Then, click Browse, and look for the file you just downloaded (CreateUnitTest.vssettings) and click Open, then Next.
- You may receive warnings that mentions about compromising computer. Please do not be alerted as there are no settings with the warning icon. 🙂 Click Finish then it will apply the settings. Lastly click Close to end the wizard.
There you go, “Create Unit Tests…” menu is BACK! Do leave your comment or like my Facebook Page (not compulsory) whether the solution is working for you or not. 🙂
Solution 2: The Alternative Way
This solution was contributed by Serena Yeoh, Windows Azure MVP where the key method is to trick Visual Studio that “Create Unit Tests…” menu is not part of the removed functionality (IsPartialRemoval=”false”) by changing the order of menu in Editor Context Menu | Code Window. Check out the steps:
- Go to Visual Studio 2012, select TOOLS –> Customize…
- Click Commands tab, then select Context Menu radio button, and choose Editor Context Menus | Code Window from the dropdown menu.
- Scroll down Controls, til you see “Create Unit Tests…” context menu. Click Move Up or Move Down button and click Close.
- Restart Visual Studio 2012. (Close everything and start your project again)
- “Create Unit Tests…” menu is back!
Don’t you feel that your productivity in Unit Testing just increased by multifold?
Happy Unit Testing!