How to measure Code Coverage in ASP.NET Core projects in Visual Studio?

后端 未结 7 1335
轮回少年
轮回少年 2020-12-30 05:03

I want to measure the Code Coverage of my XUnit-Tests in an ASP.NET Core application. The Tooling for .NET Core in Visual Studio 2015 is preview 2 and code coverage does not

相关标签:
7条回答
  • 2020-12-30 05:45

    OpenCover+ReportGenerator. Install as NUGET packages to one of your test projects (once, because they just need to appear in package folder).

    Then you can put this powershel https://github.com/rpokrovskij/opencover4vs.ps1 to your solution folder, and setup it with your Test projects using path globing e.g.

    $TestProjectsGlobbing = @(,'*.Test.csproj')

    Then you can run it as a regular Powershel script. Result should appear in Solution Folder in \TestsResults\report\index.html

    0 讨论(0)
提交回复
热议问题