dotCover 2023.3 Help

About

JetBrains dotCover is a .NET unit test runner and code coverage tool. dotCover lets us analyze how much of our .NET application code is actually being tested. By measuring method calls during unit tests or when running the application manually, dotCover shows us which statements were covered and which were not.

To quickly get started with dotCover, refer to How to Get Started.

What is code coverage

In unit testing, code coverage is a measure that describes how many lines of your code are executed while automated tests are running. Consider the example below:

Introduction to code coverage. Unit tests and source code

After you run the TestCircleLength() test with enabled coverage analysis, dotCover will show you how much of the source code does the test cover:

Introduction to code coverage. Unit tests coverage

Is it only for unit tests?

No, along with unit tests, there is a so-called 'application coverage analysis'. During this analysis, you run your application under the dotCover's control and go through particular usage scenarios. The main purpose here is to understand what parts of the code are called during a particular scenario and what parts are not reached.

Introduction to code coverage. Application coverage

How can you run dotCover

The way you run dotCover may vary depending on your needs:

Why does code coverage matter

The main purpose of dotCover is risk identification and code quality assurance. The more code is covered by tests, the safer it is to make changes without breaking something. Many software companies make a certain code coverage value a requirement that must be fulfilled before the product release. At the same time, it is worth noting that code coverage shows how much testing you are doing but not how well you are doing it.

Introduction to code coverage. Fake test
Last modified: 04 January 2024