无法在TeamCity 8和dotCover代码覆盖率中正确使用装配过滤器

5
我配置了一个Nunit测试运行器构建步骤,成功地运行了我的测试套件,指向我的.Net解决方案中的一个测试子项目,例如:Solution/Solution.Test/bin/debug/Solution.Test.dll。
我的解决方案结构如下:
-Solution --Solution.Lib --Solution.Model --Solution.Test
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)

所以我想知道在上述配置中,如果路径正确,我做错了什么?
1个回答

5
所以,我刚刚经历了这个问题。虽然这可能不是你的问题,但是我的设置中有一个错误导致我花费了太长时间去发现。由于我的应用程序命名空间(和项目文件名)是“Organization.Product”,我在测试筛选器中使用了该名称。然而,你要筛选的是程序集的名称。我的程序集输出名称是“Product name with spaces”。哎呀。无论如何,我能够通过一个更简单的筛选器使其工作:
-:*Test*

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

-:*.Test

我认为你不需要同时进行包含和排除。如果你进行排除,其他所有内容都会被包含。如果你进行包含,则其他所有内容都会被排除。


1
黄金句子:如果你进行了包含,其他所有的东西都会被排除在外。 - Mo Valipour
我在哪里可以找到assembly。我正在使用jacoco,它包含或排除所有内容。 - gkiko
我的情况是针对.NET的,因此测试存在于.dll文件中。您的测试项目生成的最终输出名称是什么?这就是您想要从代码覆盖范围中排除的内容。 - Abe Heidebrecht

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接