TeamCity with dotCover does not include all my builds in the coverage report

I want to run NUnit on TeamCity and generate a report using dotCover. But for some reason, I can’t get a coverage report for all of my projects.

TeamCity configuration 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 checked that all *.dll *.xml *.pdb are in the directory as expected, as shown below (DLL help libraries 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 using NUnit, and this assembly is excluded in the coverage report using the * Test * filter. But only MY.PROJECT.A is in the dotCover coverage report, while MY.PROJECT.B and MY.PROJECT.C not included.

I checked the log, but no error was found.

Any thoughts are greatly appreciated.

+5
source share
1 answer

Finally, I realized what was going on, and I hope that this answer will be useful to those who are still struggling with this or a similar problem.

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

In my case, the tests MY.PROJECT.A are used only by MY.PROJECT.A , MY.PROJECT.B and MY.PROJECT.C not used in the tests due to external dependencies. and even with the using MY.PROJECT.B directives in tests, this is not considered lazy loading the CLR.

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

Related question:

+4
source

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


All Articles