Closed Stefanie899 closed 5 years ago
Essentially coverage reports are generated when I run tests through the command line, but when running through the Test Explorer
@vagisha-nidhi any ideas? Seem related to VS integration
@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.
<RunSettings>
<RunConfiguration>
<TestAdaptersPaths>C:\Users\vanidhi\.nuget\packages\coverlet.collector\1.0.1\build\netstandard1.0\</TestAdaptersPaths>
</RunConfiguration>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="XPlat code coverage">
<Configuration>
<Format>lcov</Format>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>
Meanwhile, I will log this issue on vstest to get this addressed.
Thanks Vagisha for investigation, can you link here issue from vstest repo for @Stefanie899? I'm going to close this because unrelated to Coverlet.
I am not getting any coverage with test explorer and run settings as above although with .nuget\packages\coverlet.collector\3.1.2\build\netstandard1.0
Should I try version 1.0.0 ?
@tonyhallett this issue is pretty old can you open a new one? You can also enable logs in VS and verify if coverlet datacollector is loaded correctly
This 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:
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 indotnet/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?