Shortcut keys for running tests in Visual Studio

One of my most used shortcuts in Visual Studio is CTRL+R,T to debug the current test method from the code and CTRL+R,A to execute all tests. Here’s the help topic: How to: Run Selected Tests

To run tests from your test code file, by using the keyboard
1. In Visual Studio, open the source-code file that contains your test methods.
2. Click to define the testing scope: Place the cursor in a test method, in a test class, or outside the scope of a test class.
3. You can use the following keyboard shortcuts to run tests based on that scope.

CTRL + R, then press T This runs the tests in the current scope. That is, it runs the current test method, all the tests in the current test class, or all the tests in the namespace, respectively.
CTRL + R, then press C This runs all the tests in the current test class.
CTRL + R, then press N This runs all tests in the current namespace.

To run tests from source code files in your solution, by using the keyboard
1. In Visual Studio, open a source code file anywhere in your solution.
2. You can use the following keyboard shortcuts to run tests from that file.

Ctrl + R, then press A Runs all the tests in all test projects.
Ctrl + R, then press D Runs all tests that were run in the last test run.
Ctrl + R, then press F Runs all tests in the last test run that did not pass.

4.75 avg. rating (92% score) - 4 votes

About Peter Wibeck

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!

*