Unit Testing with Rider

Learn how Rider can help make sure code behaves as expected, with continuous testing and code coverage.

Testing our Code

Testing and test-driven development are development practices that many teams use. Rider comes with a test runner for .NET testing frameworks like xUnit, NUnit, and MSTest. For JavaScript and TypeScript, the test runner supports Karma, Jest, and more.

Unit tests can be run from the editor gutter, or using the unit test tool window. From there, you can group tests into a unit test session, and even refactor them.

Continuous Testing and Code Coverage

The idea of continuous testing is that you have test results instantly, as soon as you've changed your code. There is no need to manually rebuild the project and re-run all tests after making changes. Rider keeps track of which tests are affected by a code change, and runs them in the background on save (or build).

Using the code coverage tool window, you can see which lines of code are covered by test logic (or not), and helps you figure out which parts of your code base may need more tests to cover all cases.

See Also