Since installing TestDriven.Net nearly a year ago I’ve been using the context menu to run my tests. While there’s nothing wrong with this approach, sometimes when I’m feeling lazy I’ll use the mouse to drive as much as possible. However when I’m in the zone and writing code I want to keep my fingers on the keyboard as much as possible, reaching for the mouse just slows me down.
Today I decided it was time to set up a TestDriven.Net keyboard shortcut and quickly found out how. In the Tools > Options screen in Visual Studio select the Environment > Keyboard node. Then in the “Show commands containing:” box enter “testdriven” to see all options available. To create a shortcut for RunTests select the “TestDriven.NET.RunTests” option and then click the “Press shortcut keys:” textbox. Enter the keyboard shortcut combination you would like to use; if the shortcut is already in use the “Shortcut currently used by:” combo box will list all other assignments. I wanted to use CTRL+T which was already in use by “Edit.CharTranspose” – I wasn’t sure what this was but there is a handy Default Settings Shortcut Keys table on MSDN which will tell you what each command does. The assignment isn’t set until you press the “Assign” button.
The shortcut is smart like the context menu, so you can test a method, file, project or entire solution without lifting your hands from the keyboard.
You may want to assign shortcuts for the following commands:
- CTRL+T: Run Test(s) - TestDriven.NET.RunTests
- CTRL+D: Test with debugger - TestDriven.NET.Debugger
- CTRL+T CTRL+R: Repeat Test run - TestDriven.NET.RerunTests
ebcac22a-828f-468a-9374-4c94786fcd43|0|.0|96d5b379-7e1d-4dac-a6ba-1e50db561b04
Tags: testdriven.net, shortcuts, visualstudio |
Categories: ASP.NET | Development | Testing