dotCover不在覆盖率报告中包含我所有的程序集

dotCover不在覆盖率报告中包含我所有的程序集

本文介绍了TeamCity with dotCover不在覆盖率报告中包含我所有的程序集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我想在TeamCity上运行NUnit并使用dotCover生成报告.但是由于某些原因,我无法获得所有项目程序集的覆盖率报告.

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配置如下

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

我已经检查了目录中是否所有的*.dll *.xml *.pdb文件都如下所示(未列出参考DLL)

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与NUnit一起执行,并且使用* Test *筛选器将此程序集排除在覆盖率报告中.但是dotCover覆盖率报告中只有MY.PROJECT.A,而没有包括MY.PROJECT.BMY.PROJECT.C.

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.

任何想法都值得赞赏.

推荐答案

最后,我弄清楚了发生了什么,希望这个答案对仍在努力解决这个问题或类似问题的人有用.

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.

基本上,dotCover仅包括代码覆盖率报告中的测试实际上使用了那些程序集(更确切地说,是由CLR加载的那些程序集).

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

在我的情况下,测试仅使用MY.PROJECT.A,由于外部依赖性,测试未使用MY.PROJECT.BMY.PROJECT.C.即使在测试中使用using MY.PROJECT.B指令,也不会算作CLR的延迟加载.

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.

为这两个程序集显示0%覆盖率报告的虚拟解决方法是要么在测试中使用程序集中的任何内容,要么通过调用System.Reflection.Assembly.Load("MY.PROJECT.B")

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")

相关问题:

  • Visual Studio Code Coverage Not Showing All Assemblies
  • What constitutes full code coverage ...

这篇关于TeamCity with dotCover不在覆盖率报告中包含我所有的程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 13:41