Unit testing improvements in Rider 2017.3

In the latest Rider 2017.3 EAP builds, we have been hard at work improving the test runner experience. We’ve added a couple of new actions to re-run failed tests and repeat tests until failure. The Tests menu is now a separate menu entry, featuring all test runner actions. Filters are now visible based on context. Various UI improvements were made, making the test runner tool window nicer to work with.

Several bugs were fixed as well: when a filter is set (e.g. “show only failed tests”), unit test actions now use this filter. Some problems with NUnit on Linux and macOS were resolved as well.

Let’s look at a few of the unit test runner improvements!

New actions: Rerun Failed Tests / Repeat Tests Until Failure

When a test fails, we typically want to be able to quickly run it again after making a code change, to see if it passes. Both the toolbar as well as the Unit Testing quick list (Shift+Alt+U in Visual Studio keyboard scheme) now allow to Rerun Failed Tests (Ctrl+U, F).
Re-run failed unit tests in Rider

Imagine having a test that is green and passes 99.9% of the time, but every now and then fails – a so-called “flaky test”. Instead of having to manually re-run the test over and over again, Rider 2017.3 now comes with a new action Repeat Tests Until Failure which lets us continuously run a given test session until one of the tests fails. This helps in reproducing the “red test” situation locally and checking out the logs.
Run tests until failure

UI improvements and keyboard shortcuts

A number of improvements were made to the unit tests tool window UI. For example, the filter panel now only displays filters that are applicable. In other words: there will not be a “show only failed tests” filter when all tests succeeded:
Unit test runner context-aware filters

We have moved the Tests menu from Tools to its own top-level menu. Context menu entries have been re-ordered and extended: actions for Show source and Copy are now available.
New actions in context menu

We also made various small UI fixes, such as removing of unnecessary toolbar buttons (e.g. rename test session which is now only available from the context menu), double borders, etc.

The Unit Testing quick list (Shift+Alt+U in Visual Studio keyboard scheme) is now also context-aware and displays different entries when invoked from the editor or from the unit test tool window.
Unit testing quick list

Note that the available actions can be configured from Rider’s settings under Keymap, then Tests | Unit Tests Tool Window Actions.

Several keyboard shortcuts were added to the unit test tool window. When browsing a unit test session, we can now use the Delete key to remove a test from the current session, Shift+Enter will run selected tests and Ctrl+D (Command+D on Mac) will debug selected tests.

Also when browsing a unit test tree, we can just start typing to search for a given unit test. Rider will now search in all nodes, even when they are not expanded.
Search tests tool window

Give Rider 2017.3 EAP a try! We’d love to hear your thoughts and comments.

image description