TL;DR Can I still debug a test in the current context in VS11?
Unit testing using mstest in Visual Studio (verified in 2010 and 11, and even 2008 apparently) has a command called Test.DebugTestInCurrentContext. It runs a single test in debug mode.
To use this command, you place your cursor anywhere in the method (the unit test in question) and then either
1 Use the (default) keyboard shortcut Ctrl+R, Ctrl+T
or
2 Use the menu option Test=>Debug=>Tests in Current Context. (2010, don’t know about 2008)
I’m now using VS 11 Beta, and found that hitting ^R,^T did nothing (is not a command). I checked the key bindings and found the command Test.DebugTestInCurrentContext, mapped it to ^R,^T as we expect, and tried again. This time the status bar reports:
The key combination (Ctrl+R, Ctrl+T) is bound to (DebugTestsInCurrentContext) which is not currently available.
Visual Studio 11 has a new Unit Test Explorer. After having run all tests once, it is populated with the solutions unit tests. At this point I am able to scroll…and scoll (I have a few tests), and find the one test I am interested in debug, and select it (highlight it). At this point I can right click => "Debug Selected Tests", or navigate the menu, Unit Tests=>Debug Unit Tests=>Selected Tests.
Thus, I have found I can debug a single unit test in VS11 by
1 Find the unit test in the unit test explorer after having run all tests
2 Select it
3 Execute "Debug Selected Tests"
Is there an easier way? Can I not use the old command to debug tests in the current context? Is that command obsolete?
I decided to ask my question on the msdn forums. I got a response, in short: “the feature is broken in beta, will be back in rtm”
Read the full answer here.