C# – Run specific unit test in Visual Studio

cvisual studio 2010

I have dozens of unit tests, and I'd like to fix the code I am working on now, but every time I run the tests it takes over 30 seconds to run every unit test (I think reflection is the cause of some of these being especially slow). My current test and many other tests take less than one second to run, but it is annoying to disable and then enable specific unit tests.

Is there a way to say, "For now, run a single, specific test?"

I'm using Visual Studio 2010 with the built-in unit test system. I create tests by right-clicking any code and selecting "create unit test" which creates a project.

Best Answer

Resharper and Test Driven .Net both have this feature in their visual studio test-runners. There may well be other VS plugins too.

According to this answer (By Jon Skeet no less) it is possible in Visual studio natively too. To debug a single test:

Click on a test method name, then press Ctrl+R, Ctrl+T. (Or go to Test / Debug / Tests in Current Context.)

EDIT: (based on a comment from Justin R below) to run a test (as opposed to debugging it) the command is simply:

Ctrl+R, T