If you are a .NET developer who wants to ensure the quality and reliability of your code, you need a code coverage tool that can help you measure how well your code is tested. Code coverage is a metric that shows the percentage of code statements that are executed by unit tests. A high code coverage indicates that your code is well-tested and less likely to contain bugs or errors.
One of the best code coverage tools for .NET developers is dotCover 21, a product by JetBrains that integrates with Visual Studio and JetBrains Rider. dotCover 21 is a powerful and easy-to-use tool that can analyze and visualize code coverage for applications targeting .NET Framework, .NET Core, Mono, or Mono for Unity. In this article, we will show you how to use dotCover 21 to run and analyze code coverage for your .NET projects.
To use dotCover 21, you need to have Visual Studio 2010 or later, or JetBrains Rider 2018.2 or later installed on your machine. You can download dotCover 21 from the official website[^1^] and install it as a standalone application or as part of dotUltimate, a single license that includes other JetBrains tools such as ReSharper, Rider, and ReSharper C++.
After installing dotCover 21, you will find its commands under the ReSharper Unit Tests and ReSharper Cover menus in Visual Studio, or under the Unit Testing menu in Rider. You can also access dotCover 21 settings from the Tools Options dotCover menu in Visual Studio, or from the File Settings Build, Execution, Deployment dotCover menu in Rider.
To run code coverage analysis with dotCover 21, you need to have some unit tests written for your code. dotCover 21 supports many unit testing frameworks such as MSTest, NUnit, xUnit, and MSpec. You can write your unit tests using Visual Studio or Rider, or use any other IDE or editor of your choice.
Once you have some unit tests ready, you can run them with code coverage analysis using dotCover 21. There are two ways to do this: using the Unit Test Runner or using the Manual Test Session.
The Unit Test Runner is a feature of ReSharper and Rider that allows you to execute and debug unit tests in Visual Studio or Rider. To run your unit tests with code coverage analysis using the Unit Test Runner, follow these steps:
The Manual Test Session is a feature of dotCover 21 that allows you to run code coverage analysis for any application without running unit tests. This is useful when you want to measure code coverage for manual testing scenarios such as debugging, exploratory testing, or user acceptance testing. To run code coverage analysis using the Manual Test Session, follow these steps: