TestDriven.NET keyboard shortcut


Continuing with the Palermo brain dump theme, Jeffrey introduced me to a keyboard shortcut for running TestDriven.NET tests from a keyboard shortcut.  I had been right-clicking and going from the context menu:

While the context menu is nice, it has me reaching for the mouse (like a chump).   Instead, I can set a keyboard shortcut to perform the same context-sensitive testing.

To set the keyboard shortcut, first go to “Tools->Options…” to bring up the Visual Studio Options dialog, then select the “Environment->Keyboard” screen:

In the “Show commands containing:” text box, enter “TestDriven” to get the the TestDriven.NET command quickly.  Select the “TestDriven.NET.RunTests” command and click the “Press shortcut keys:” text box.  Now enter the keyboard shortcut you like (I use ‘Ctrl-T’) and click the Assign button.  The shortcut key is not assigned until you click the “Assign” button.

Once you assign the shortcut, I additionally set the “Use new shortcut in:” to “Text Editor”.  For some reason, setting “Global” wasn’t enough, I had to set the “Text Editor” command also.

With this keyboard shortcut in place, you don’t need to lift your hand to the mouse after writing your test.  The shortcut also works everywhere the TestDriven.NET menu works, so I can select a file, project, or solution in the Solution Explorer and run all of the tests with a quick keystroke.  Since the context menu gets pretty unruly, I save some time I normally spend searching through a menu that now stretches my entire screen.

Moving past stored procedures