5

我已经配置了一个 Nunit 测试运行器构建步骤,它成功运行了我的测试套件,指向我的 .Net 解决方案的测试子项目,例如。解决方案/Solution.Test/bin/debug/Solution.Test.dll。

我的解决方案结构如下:

  • 解决方案
    • 解决方案.Lib
    • 解决方案.模型
    • 解决方案.测试

测试项目中引用了 Lib 和 Model dll。

然后我在没有任何程序集过滤器的情况下打开了 dotCover,它正确地对上述测试 dll 执行了代码覆盖率分析。

然后我添加了一个过滤器 -:Solution.Test,并将 +:Solution.Lib 和 +:Solution.Model 添加到程序集过滤器并运行构建配置,并且 build.log 报告了以下内容:

Generate dotCover HTML report
[17:15:41][Generate dotCover HTML report] No source files were found under the build checkout directory W:\TeamCity\Install\buildAgent\work\7136872008cbf3bf. No source files will be included in dotCover report as source code of classes.

No executable code was detected. 
The issue could be caused by one of the following:
- Include / exclude patterns are incorrect
- Assemblies are compiled without debugging information
- .pdb files are not available
- Visual Studio code coverage is enabled for MSTest
- .testrunconfig is used for MSTest and Visual Studio code coverage is not disabled (CodeCoverage section with enable="true" is present)

所以我想知道上面的配置我做错了什么,如果路径正确?

4

1 回答 1

5

所以,我只是亲身经历了这一点。虽然这可能不是您的问题,但我的设置中有一个错误,我花了长时间才弄清楚。

由于我的应用程序的命名空间(和项目文件名)是Organization.Product,因此我在测试过滤器中使用了它。但是,它是您要过滤的程序集的名称。

我的程序集的输出名称是Product name with spaces. 哎呀。

无论如何,我能够让它使用更简单的过滤器:

-:*Test*

您的过滤器可能只是:

-:*.Test

我还要说您不需要同时进行包含和排除。如果您进行排除,则将包括其他所有内容。如果您进行包含,则其他所有内容都将被排除在外。

于 2014-04-25T18:53:53.373 回答