TeamCity with dotCover does not include all my assemblies in coverage report
Asked Answered
S

1

7

I want to run NUnit on TeamCity and generate report with dotCover. But for some reasons I cannot get the coverage report for all my project assemblies.

TeamCity config as below

Teamcity: 6.5.3 
NUnit: 2.5.10 
.NET Runtime: Platform: x86
.NET Runtime: Version: v4.0
dotCover: bundled with TC not customized

I have checked that all *.dll *.xml *.pdb files are there in the directory as expected as below (reference DLLs are not listed)

MY.PROJECT.A.dll
MY.PROJECT.A.pdb
MY.PROJECT.A.xml
MY.PROJECT.B.dll
MY.PROJECT.B.pdb
MY.PROJECT.B.xml
MY.PROJECT.C.dll
MY.PROJECT.C.pdb
MY.PROJECT.C.xml
MY.PROJECT.Test.dll
MY.PROJECT.Test.pdb
MY.PROJECT.Test.xml

MY.PROJECT.Test.dll is executed with NUnit and this assembly is excluded in the coverage report by using *Test* filter. But only MY.PROJECT.A is in the dotCover coverage report whereas MY.PROJECT.B and MY.PROJECT.C are not included.

I checked the log but not error is found.

Any thoughts is much appreciated.

Styracaceous answered 21/10, 2014 at 10:1 Comment(0)
S
4

Finally, I figured out what is going on, and hope this answer is useful for those who are still struggling with this or similar problem.

Basically, dotCover only includes those assemblies are actually used (more precisely, those assemblies loaded by CLR) by the tests in the code coverage report.

In my case, only MY.PROJECT.A is used by tests, MY.PROJECT.B and MY.PROJECT.C are not used by tests due to external dependencies. and even with using MY.PROJECT.B directives in the tests, it does not count as CLR's lazy loading.

One dummy workaround to show 0% coverage report for these two assemblies is that either use anything in the assembly in the tests, or force load these assemblies by calling System.Reflection.Assembly.Load("MY.PROJECT.B")

Related Question:

Styracaceous answered 22/10, 2014 at 2:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.