teamcity - 无法获得正确的程序集过滤器来使用 TeamCity 8 和 dotCover 代码覆盖率

标签 teamcity code-coverage dotcover

我已经配置了一个 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)

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

最佳答案

所以,我自己也经历过这一点。虽然这可能不是您的问题,但我的设置中有一个错误,花了我方式很长时间才弄清楚。

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

我的程序集的输出名称是带空格的产品名称。哎呀。

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

-:*Test*

您的过滤器可以简单地是:

-:*.Test

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

关于teamcity - 无法获得正确的程序集过滤器来使用 TeamCity 8 和 dotCover 代码覆盖率,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21898209/

相关文章:

unit-testing - C++ 代码的 TeamCity 代码覆盖率

linux - 我可以在 Linux Docker 容器中运行 JetBrains dotCover 吗?

tfs - TeamCity CI 为 TFS 功能分支构建

visual-studio - TeamCity Visual Studio 插件

svn - 使用 teamcity 在 svn 中自动分支

xcode - 命令行工具的静态分析问题

workflow - 基于 TFS 2010 工作流的团队构建能否获得代码覆盖率结果?

php - PHPUnit 6.5.5 和 PHP 7.2 的测试覆盖率

azure - 我可以从 Azure 上的部署生成代码覆盖率吗?

teamcity - 在TeamCity构建配置中使用dotCover时,是否存在用于代码覆盖率的环境变量?