4

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

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

The simplest example we have of this is a namespace with one class. This class is just a list of 6 constants. So it has 6 public static properties.

When we view the code it shows all 6 lines in green.

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

We do not have this problem on all projects or all DLLs in a project, I have not been able to identify any pattern.

Does anyone know what could be causing this problem?

Makoto
  • 104,088
  • 27
  • 192
  • 230
Shiraz Bhaiji
  • 64,065
  • 34
  • 143
  • 252
  • I'm a little late to the party but anyway, if you're still running into this problem, which version of TeamCity and which unit testing framework are you using? – Jura Gorohovsky Jan 12 '12 at 17:55

1 Answers1

1

I just hit exactly this problem (teamcity 7.1.5, the builtin dotcover, msunit test framework).

The cause for me was that I had multiple assemblies being tested in a single build step. Assembly1 and Assembly2 both used Assembly3, and it was Assembly3 that had this problem -- Assembly3 showed up with exactly half the coverage it should, as described in the question.

Solution: make two separate build steps, one to test Assembly1 and one to test Assembly2. Now I don't get this problem any more, and the end results come out correctly; the tests all still run, and the code coverage results are accurate.

Dan Mitchell
  • 715
  • 1
  • 7
  • 13