Unit Testing Improvements in Rider 2019.1

In the latest Rider 2019.1 Early Access Preview (EAP) builds, we made a number of improvements to unit testing – in the overall performance as well as the UI/UX experience.

For example, it’s now possible to run tests from Find Usages, making it easy to find tests that use a certain type or method we want to verify. Rider can now track running tests, automatically showing details for the test that is running.

Next to these, a number of UI/UX improvements were made. Additional grouping rules have been added, including grouping by namespace or by category. The test tree and output pane are automatically split horizontally/vertically based on available space. We can now also customize the testing toolbar and hide empty test filters. More than enough to have a closer look!

DOWNLOAD Rider 2019.1 EAP

Performance!

In earlier releases, the test tree was kept in memory in both the front-end and Rider’s back-end (read more on Rider’s architecture). This meant that in solutions with a large number of tests, there was quite some impact on performance and memory usage.

The test runner’s performance and memory usage have greatly improved in this release! The test tree is now fully asynchronous and only synchronizes the view model for expanded parts of the test explorer and test sessions. This refactoring makes working with tests faster and speeds up solution loading.

Run/debug tests from Find Usages

Want to check if a given class or method is used in test code directly? We can do that with Find Usages (Shift+F12). Even better, for test methods that are found we can now immediately run the test by using the context menu (or keyboard shortcut).

Run test from Find Usages tool window

Tip: Find Usages will only find tests when they reference our class or method directly. Not to worry! We can always use unit test coverage and dotCover to get more accurate navigation between code under test and the tests that use it.

From the test tool window, we can now also Navigate to… (Alt+`) a test class or test method’s implementation, Find Usages of a test, and perform other actions.

Navigate To / Find Usages from unit test tool window

Track running tests

In the unit tests tool window, we’ve added a new option called Track Running Test. When enabled, Rider automatically selects the test that is currently running in the test tree so that we can follow its output while executing.

Track running test

Note that while running tests, we now also show a progress bar which displays the number of tests passed, failed or ignored, helping us keep track of how far along our test run is.

Improvements to UI/UX and performance

Rider 2019.1 comes with several UI/UX improvements for the test runner. Test frameworks like MSTest, NUnit, and xUnit allow you to group tests by category:

The test runner in Rider now lets us group by namespace and test categories as well:

Group tests by category and more

The splitter between the test tree and test output now automatically moves from horizontal to vertical and back, based on the available screen real estate. Note that from the toolbar, we can lock it in the horizontal or vertical position.

Automatic smart splitter

The toolbar can now be customized from Rider’s settings (under Appearance & Behavior | Menus and Toolbars, find the Unit Test Tool Window toolbars).

Customize the test runner toolbars

In the toolbar, test filters are automatically displayed or hidden based on whether there are tests that match a filter or not. So if no tests failed, that filter will not be shown. This behavior can be toggled from the toolbar (Hide Empty Test Filters).

When a test fails, stack traces in the result pane can be navigated using the Ctrl+Alt+Up/Down keyboard shortcuts.

Download Rider 2019.1 EAP and give it a try! We’d love to hear your feedback.

This entry was posted in How-To's and tagged , , , , , . Bookmark the permalink.

4 Responses to Unit Testing Improvements in Rider 2019.1

  1. Fabian Schmied says:

    Since you’re doing a lot for unit testing performance, is there a chance we can get https://youtrack.jetbrains.com/issue/RSRP-474062 fixed in R# 2019.1 (and Rider) or a patch release? This looks like a really simple change, and it would eliminate about 4s “waiting time” when running tests that use Entity Framework.

  2. Mark says:

    Is there a chance to get Rider closer to IntelliJ’s behavior in regards to testing?
    As a developer in both Kotlin/Java I’m used from IntelliJ to rerun my latest tests with Shift+F10 (for last run configuration).

    While trying to convert from Visual Studio to Rider, I use a lot of muscle-memory-bound shortcuts because the environment fells like IntelliJ (which is awesome!) and everytime I try to rerun my test I accidentaly start the application :-)
    Now I’ve seen that test sessions are somewhat available as run configurations, howver this is still a huge difference to the behavior I’m used to and as I understand I would have to add some tests to a new session and then run them once through the run configuration to be able to rerun them faster.

    The default keybindings (CTRL+;) which I can see in the Unit Testing quick list are kinda weird on German keyboard layouts and I couldn’t get them to work even once :-)

Leave a Reply

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