无法获得正确的程序集筛选器以与TeamCity 8和dotCover代码覆盖一起使用 [英] Can't get correct assembly filters to work with TeamCity 8 and dotCover code coverage

查看:103
本文介绍了无法获得正确的程序集筛选器以与TeamCity 8和dotCover代码覆盖一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have configured a Nunit test runner build step which successfully runs my testsuite, pointing at a test sub-project of my .Net solution eg. Solution/Solution.Test/bin/debug/Solution.Test.dll.

我的解决方案结构如下:

My solution structure is as follows:

  • 解决方案
    • Solution.Lib
    • Solution.Model
    • Solution.Test
    • Solution
      • Solution.Lib
      • Solution.Model
      • Solution.Test

      在测试项目中引用了库和模型dll.

      Lib and Model dlls are referenced in the test project.

      然后我打开没有任何汇编过滤器的dotCover,它正确地对上述测试dll进行了代码覆盖率分析.

      I then turned on dotCover without any assembly filters and it performed code coverage analysis on the above test dll correctly.

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

      I then added a filter, -:Solution.Test, and added +:Solution.Lib, and +:Solution.Model to the assembly filters and ran the build configuration, and the build.log reported the following:

      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)
      

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

      So I'm wondering with the above configuration what am I doing wrong, if the paths are correct?

      推荐答案

      所以,我自己才经历过.尽管这可能不是您的问题,但我的设置中存在一个错误,导致我方法花了很长时间才弄清楚.

      So, I just experienced this myself. While this may not be your issue, I had a bug in my setup that took me way too long to figure out.

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

      Since my application's namespace (and project file name) is Organization.Product, I used that in my test filter. However, it is the name of the assembly that you're filtering on.

      我的程序集的输出名称是Product name with spaces. kes.

      And my assembly's output name is Product name with spaces. Yikes.

      无论如何,我能够使它与更简单的过滤器一起工作:

      Anyway, I was able to get it to work with a simpler filter:

      -:*Test*
      

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

      Your filter could simply be:

      -:*.Test
      

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

      I would also say that you don't need to do both inclusions and exclusions. If you do an exclusion, everything else will be included. If you do an inclusion, everything else will be excluded.

      这篇关于无法获得正确的程序集筛选器以与TeamCity 8和dotCover代码覆盖一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆