No coverage file generated at all
See original GitHub issueThe following command (generated through Nuke) does not generate a coverage report:
“C:\Program Files\dotnet\dotnet.exe” test C:\source\repos\MyProject\MyProject.sln --configuration Debug --logger trx;LogFileName=TestResults.trx --no-build --no-restore --results-directory C:\source\repos\MyProject\artifacts\tests\results /property:CollectCoverage=True /property:CoverletOutputFormat=cobertura /property:CoverletOutput=C:\source\repos\MyProject\artifacts\tests\results\coverage.xml
But running dotnet test --collect:"XPlat Code Coverage" works just fine.
I suppose this is a user error. Could you give me a hint what I am missing?
This is how the MyProject.Tests.csproj looks like:
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net6.0-windows</TargetFramework>
    <IsPackable>false</IsPackable>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="FluentAssertions" Version="6.2.0" />
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
    <PackageReference Include="xunit" Version="2.4.1" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
    <PackageReference Include="coverlet.collector" Version="3.1.2">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\..\src\MyProject\MyProject.csproj" />
  </ItemGroup>
</Project>
Issue Analytics
- State:
 - Created 2 years ago
 - Comments:9
 
Top Results From Across the Web
gcov does not generate coverage files
I am cross compiliing my executable for coverage using -fprofile-arcs -ftest-coverage flags on a 32 bit machine . And the resulting executable I ......
Read more >Jest is "stuck" on only generating coverage for tested files ...
Coverage report for all files worked fine in v23 but seem like it has regressed in v24 - I'm only seeing coverage for...
Read more >Troubleshoot code coverage - Visual Studio
Learn how to resolve erroneous empty results messages when you expect Visual Studio to collect data for native and managed assemblies.
Read more >Not able to generate ".coverage" report while running code ...
I'm trying to run code coverage testing from command line using below commands: vstest.console.exe CoverTest.dll /EnableCodeCoverage ...
Read more >How To Generate Pytest Code Coverage Report
Once the code runs successfully, open the coverage_reports folder and open the index.html file via a browser. The code coverage reads 94%, as ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thank you @petli again for your help!
trx is unrelated to datacollector self it should work with that command line.