Coverage Report not Generated When Running through VS 2019 Test Explorer -- coverlet.collector
See original GitHub issueThis issue is occurring when using coverlet.collector v1.0.0
. Essentially coverage reports are generated when I run tests through the command line, but when running through the Test Explorer, coverage reports are not generated.
I have set up a .runsettings file which essentially just describes which format to use and some custom exclusions I need for my project:
<?xml version="1.0" encoding="utf-8" ?>
<RunSettings>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="XPlat code coverage">
<Configuration>
<Format>lcov</Format>
<Exclude>[*.tests]*,[*.testing]*,[xunit.*]*,[*.SqlServer]*</Exclude> <!-- [Assembly-Filter]Type-Filter -->
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>
I have selected this .runsettings file to be used in VS2019 through the Test > Test Settings > Select Test Settings File option. When I run a test using the Test Explorer, it generates the folder, but never actually spits out the coverage report.
Additional Details: I have a tests project called Refactored.Web.Tests
. When I run through the console: dotnet test dotnet/Tests/Presentation/Refactored.Web.Tests/Refactored.Web.Tests.csproj --no-restore --settings coverletArgs.runsettings
it generates a folder in dotnet/Tests/Presentation/Refactored.Web.Tests/TestResults
with the coverage report in said folder.
When I run it through the Test Explorer, it generates a folder in the root of the solution at dotnet/TestResults
but without the associated coverage report.
Is there something I’m missing to get this to generate as expected?
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
@MarcoRossignoli @Stefanie899 Yes the issue is related to VS integration. Any custom datacollector path is not automatically known when running via VS. In dotnet test, this happens because we set the test adapter path to find the datacollector in the targets file https://github.com/tonerdo/coverlet/blob/master/src/coverlet.collector/build/netstandard1.0/coverlet.collector.targets
As a workaround, you can specify the test adapter path to the coverlet.collector nuget path as below.
Meanwhile, I will log this issue on vstest to get this addressed.
responding in https://github.com/coverlet-coverage/coverlet/issues/1332