question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No coverage file generated at all

See original GitHub issue

The 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:closed
  • Created 2 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
bitbonkcommented, Mar 17, 2022

Thank you @petli again for your help!

1reaction
MarcoRossignolicommented, Mar 17, 2022

trx is unrelated to datacollector self it should work with that command line.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found