无法获得正确的汇编过滤器以使用TeamCity 8和dotCover代码覆盖率

the*_*rrs 5 teamcity code-coverage dotcover

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

我的解决方案结构如下:

    • Solution.Lib
    • Solution.Model
    • Solution.Test

Lib和Model dlls在测试项目中引用.

然后我打开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)
Run Code Online (Sandbox Code Playgroud)

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

Abe*_*cht 5

所以,我自己就是经历过这一点.虽然这可能不是您的问题,我在我的设置是把我有一个bug 方式太长弄清楚.

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

我的程序集的输出名称是Product name with spaces.让人惊讶.

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

-:*Test*
Run Code Online (Sandbox Code Playgroud)

您的过滤器可能只是:

-:*.Test
Run Code Online (Sandbox Code Playgroud)

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