Unit testing
JetBrains Rider helps discover and run, debug, cover, or profile unit tests . The following unit testing frameworks are supported:
NUnit — JetBrains Rider installation includes 2 bundled test runners that support versions up to 2.7.1 and up to 3.15.5 correspondingly. Other versions up to 4.1.0 are supported and will be used if the corresponding NuGet package is installed in the project.
MSTest V1 (Windows only, requires Visual Studio installed), V2 (.NET Core, cross-platform)
Custom test frameworks that use VSTest and Microsoft.Testing.Platform.
To enable support of these frameworks, select the corresponding checkboxes on the
page of JetBrains Rider settings Ctrl+Alt+S.
With JetBrains Rider, you can execute a single unit test, all tests in a test class, file, project or solution. You can also execute any number of tests combined in a test session.
Besides running and debugging unit tests, you can analyze code coverage of unit tests and run performance profiling of unit tests.
Before running coverage analysis or performance profiling, make sure that the PDB information exists for all target assemblies. The safest choice would be to build your code with the Debug build configuration.
In this section:
- In current document
- In project or solution
- Unit test sessions
- Test categories
- Execute tests and analyze results
- Create unit tests
- Navigate between tests and tested code
- Maintain code quality of unit tests
- Monitor memory with dotMemory Unit
- Unit Tests window
- Unit Tests Coverage window
All JetBrains Rider unit testing actions are available from the
menu or from the Unit Testing Quick List Alt+Shift+U:![JetBrains Rider: Unit Testing Quick List JetBrains Rider: Unit Testing Quick List](https://resources.jetbrains.com.cn/help/img/rider/2024.2/unit_test_quick_list.png)
You can use the following shortcuts for unit testing commands:
Unit testing
Unit Testing Quick List... | Alt+Shift+U |
Ctrl+;, R | |
Ctrl+;, D | |
Ctrl+;, S | |
Ctrl+T, C | |
Ctrl+T, G | |
Ctrl+;, T | |
Ctrl+;, F | |
Ctrl+;, W | |
Ctrl+;, L | |
Ctrl+;, N | |
Ctrl+;, A | |
Ctrl+;, Y | |
Ctrl+;, M | |
Shift+Enter | |
Ctrl+D | |
Ctrl+Y | |
Alt+Shift+Insert | |
Ctrl+Alt+Insert | |
Delete | |
Ctrl+L | |
Alt+Shift+8 |
For the full list of JetBrains Rider keyboard shortcuts, refer to Keyboard shortcuts in predefined keymaps.