Error in dotCover statistics when starting from TeamCity

We have a number of projects that build and run tests through TeamCity. For these projects, code coverage is calculated using the dotCover method.

In some cases, it counts the lines twice and, therefore, shows only half the coverage.

The simplest example of this is a single-class namespace. This class is just a list of 6 constants. Thus, it has 6 publicly available static properties.

When we look at the code, it shows all 6 lines in green.

But in statistics, it reports 12 lines, since only (all) 6 are tested, coverage is 50%.

We do not have this problem for all projects or all DLLs in the project, I could not identify any template.

Does anyone know what might cause this problem?

+4
source share
1 answer

I just hit exactly this problem (teamcity 7.1.5, built-in dot, msunit test environment).

The reason for me was that I tested several assemblies at one stage of the assembly. Assembly 1 and Assembly 2 used Assembly 3, and it was this problem that the Assembly had 3. Assembly 3 showed exactly half the coverage, as described in the question.

Solution: Make two separate assembly steps, one for testing Assembly1 and one for testing Assembly2. Now I no longer get this problem, and the final results come out correctly; all tests are still running and the results of code coverage are accurate.

+1
source

Source: https://habr.com/ru/post/1381143/


All Articles