Using .runsettings to exclude assemblies from code coverage

前端 未结 5 991
孤城傲影
孤城傲影 2020-12-09 03:40

When running code coverage for my solution which contains multiple projects, I noticed that Code Coverage includes also my test assemblies.

I found an article which

5条回答
  •  旧时难觅i
    2020-12-09 04:30

    I had all sorts of issues getting to work reliably (using ASP.NET Core 2.1).

    In the end I found that using the was simple and more reliable and worked exactly as I needed. You still leverage the advice on the use of regex.

    I include my solution path, and exclude my \tests subfolders where all my test projects live. Example for CodeCoverage element in RunSettings xml file:

    
      
        
          .*\\My\.Solution\.Name\.Space\\.* 
        
        
          .*\\My\.Solution\.Name\.Space\\Tests\\.* 
        
      
      
    
    

    See more at: Customising Code Coverage on MS Docs

提交回复
热议问题