问题
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