JetBrains Rider 2018.2 Help

Working with Unit Tests in Project or Solution

Discovering unit tests in solution

For unit test management, JetBrains Rider provides the Unit Tests window ( View | Tool Windows | Unit Tests ). Using this window, you can explore and run, debug or cover unit tests of all supported frameworks in the entire solution. Note that unit tests from a project only appear in the window after the project is built. Tests from currently opened files are updated automatically, new tests from the opened files appear in the unit test explorer as soon as you create them.

Unit Test Explorer displays tests from the entire solution

Unit test explorer allows you to do the following:

  • Explore tests in the solution: browse all unit tests, search tests by a substring, regroup unit tests by project, namespace, etc.

  • Navigate to source code of any test or test class by double-clicking it in the view.

  • run, debug or cover selected tests.

  • Create unit tests sessions from selected tests and test classs and/or add selected items to the current test session.

Executing and covering unit tests in project or solution

You can run, debug or cover tests from the Unit Test Explorer or Solution Explorer. Unit Test Explorer gives you the advantage to see only tests and test classes, while using other windows you need to know, which projects, files, and classes contain tests.

  • To execute tests from Unit Test Explorer, select the desired tests and click Run Unit Tests ThemedIcon RunTest Screen Gray / Debug Unit Tests ThemedIcon Debug Screen Gray or Cover Unit Tests ThemedIcon JetBrainsDotCoverPresentationVsResourcesUnitTestingCoverageCover Screen Gray on the toolbar or use the corresponding shortcuts (Ctrl+U, R / Ctrl+U, D ).

  • To run, debug or cover all tests in solution, choose Tests | Run All Tests from Solution in the main menu or press Ctrl+U, L.

Whatever way you choose to run, debug or cover tests, you will see the execution progress, results, and output in the Unit Tests window. If there is an open unit test session, the executed tests are added in this session. If there are no test sessions or the existing ones are locked, then a new tests session is created.

If necessary, you can always repeat execution or coverage analysis of the tests that you executed last by pressing Ctrl+U, U or choosing Tests | Repeat Previous Run in the menu.

You can also re-run tests that failed by pressing Ctrl+U, F or choosing Tests | Rerun Failed Tests in the menu.

Last modified: 4 October 2018