Can you use Coverlet to get code coverage data in a .NET Framework project?

三世轮回 提交于 2020-04-18 06:11:09

问题


I have a large .NET Framework solution and want to start collecting code coverage data as part of our build pipeline (as well as on our local developer machines).

On the Coverlet GitHub page it says that it supports .NET Framework projects but all the examples are using the dotnet test CLI command.

Is it possible to use Coverlet for this or should I be looking at something like OpenCover?


回答1:


  • Use the task Visual Studio Test
  • Create a .runsettings file and configure Coverlet in the .runsettings (see https://github.com/tonerdo/coverlet/blob/master/Documentation/VSTestIntegration.md#coverlet-options-supported-by-vstest-integration)
  • Reference the .runsettings file in the task
  • Tick the option Code coverage enabled

If this doesn't work, use a Publish code coverage results task, to publish the corbertura file produced by the test task



来源:https://stackoverflow.com/questions/60651663/can-you-use-coverlet-to-get-code-coverage-data-in-a-net-framework-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!