New Features in ReSharper 6 Unit Test Runner

Previous posts introducing 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:

image

ReSharper outputs the results as individual tests, appropriately grouped.

image

This allows us to now run and view tests individually.

image

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

image

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 Insensitiveimage 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

SNAGHTML14c0e0a

as well as the Find Results Window

SNAGHTML14d0b1d

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

image

When running unit tests, these appear as ignored.

image

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:

image

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

image

As always, we welcome your feedback

This entry was posted in ReSharper Tips&Tricks and tagged , , . Bookmark the permalink.

7 Responses to New Features in ReSharper 6 Unit Test Runner

  1. Robert Slaney says:

    Are you also going to support the DeploymentItem attribute for MSTest. This allows units tests to run consistently between R# and TFS Build

  2. Hadi Hariri says:

    @Robert,

    I’m not sure at this point. Could you please log a feature request?

    Thanks.

  3. Markus says:

    The feature “Rerun last test. Context Insensitive” is nice.
    Is there also a feature “ReDEBUG last test. Context Insensitive”?

  4. victor.kropp says:

    Robert,

    DeploymentItem attribute is already partially supported in 6.0 and full support is ready for the next minor update.

    Markus,

    if you ran tests under debugger previous time, debug session will be repeated.

  5. Oleg Deribas says:

    There is a bug in the test runner related to NUnit’s parametrized test fixtures.
    Do you know when fix will be released?

  6. @Oleg
    What kind of issue are you referring to? this one, one of the wider list, or something that has not been put into our issue tracker at all?

    Thanks

  7. Oleg Deribas says:

    @Jura
    I found this issuein the tracker but looks like people keep filing this bug, so I’m not alone ;)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">