Search code examples
teamcitydotcover

Why are all classes showing up twice in dotCover results in TeamCity?


Using TeamCity 9.0.2, I have an Nunit build step with the following configuration:

Run tests from: **\*.Tests.dll
Do not run tests from: **\obj\**\*.dll
.NET Coverage Tool: JetBrains dotCover
Filters: -:MyAssembly.Tests (along with several namespaces in primary assembly to exclude)

After I run the build, the code coverage report shows every class twice, with the exact same output/statistics for both. For example:
Class1 100%(2/2) 100% (20/20) 75% (75/100)
Class1 100%(2/2) 100% (20/20) 75% (75/100)
Class2 100%(4/4) 100% (30/30) 80% (120/150)
Class2 100%(4/4) 100% (30/30) 80% (120/150)

Has anyone else seen the same behavior? If so, what can you suggest to resolve the issue?


Solution

  • If you have two different build configurations that can be run on the same build agent, you may get two similar test assemblies that match the ‘***.Tests.dll’ pattern, for example. As a result, coverage report may contain duplicate data.

    You can either specify target assemblies in your build step more precisely (Build Steps | Run tests from) or clean the corresponding checkout directory before the build (Version Control Settings | Clean all files in the checkout directory before the build).