.NET Tools
Essential productivity kit for .NET and game developers
New Features in ReSharper 6 Unit Test Runner
Previous posts introducing ReSharper 6:
- ReSharper 6 EAP is Open; Details on JavaScript Support
- CSS Support in ReSharper 6
- ReSharper 6 Bundles Decompiler, Free Standalone Tool to Follow
- ReSharper 6 Enhances Suggestions with Explanations
- ReSharper 6 Introduces support for JavaScript Unit Testing with QUnit
- ReSharper 6 Enhances Razor Support
- File Header Macros in ReSharper 6
ReSharper 6 includes a series of new features and improvements in the test runner, as outlined below.
NUnit TestCase
We now fully support NUnit’s TestCase, TestCaseSource, Values, Ranges and other attributes. Given the following tests:
ReSharper outputs the results as individual tests, appropriately grouped.
This allows us to now run and view tests individually.
As expected, dotCover and dotTrace also provide support for this.
Support for Coded UI Tests with MSTest
Coded UI tests (when appropriate) are also supported now with the ReSharper test runner
Default Keyboard Bindings and Test Re-Runs
Out of the box ReSharper now ships with pre-defined shortcut keys for running, debugging, re-running tests, among other things. This eases the pain of having to map keys on new installations (as of ReSharper 6, you no longer loose your key bindings during upgrades!). By default, the key-bindings for the schemes are:
Operation | Visual Studio | IntelliJ IDEA |
Run Unit Tests. Context Sensitive | Ctrl+U, R | Ctrl+T, R |
Debug Unit Tests. Context Sensitive | Ctrl+U, D | Ctrl+T, D |
Run ALL Unit Tests | Ctrl+U, L | Ctrl+T, L |
Run Current Session | Ctrl+U, Y | Ctrl+T, Y |
Rerun last test. Context Insensitive | Ctrl+U, U | Ctrl+T, T |
This last shortcut is a new feature added in 6 which allows us to re-run the last test we just ran. And we can run it from anywhere! This makes TDD for instance very easy as we can write some code, be in the actual code and run the test, without having to switch back to the test or open up the unit text explorer.
Running Tests from File Structure and Find Results Windows
You can now run Tests directly from the File Structure Window
as well as the Find Results Window
again, removing some of the friction when it comes to testing.
Categories
Certain Unit Testing frameworks provide test categories. For example, in NUnit there is the [Category] attribute. ReSharper now allows us to ignore specific categories and not run them during a test run. This is accomplished by indicating the category under ReSharper | Options | Unit Testing
When running unit tests, these appear as ignored.
This is useful for instance when we want to avoid running certain tests during development sessions.
Categories can also be used to run a specific group of tests by selecting these from the context menus:
Other improvements
Some other minor improvement or previous features we have blogged about include:
- QUnit Support
- Unit testing Sessions are now persisted between Visual Studio restarts
- Ability to run tests in parallel from different assemblies, decreasing testing time (can be turned off in ReSharper | Options | Unit Testing)
- General performance improvements
- Update Progress indicator on Windows task bar
As always, we welcome your feedback