Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

565
Views
Coverage always at 0% on sonarqube even i added test unit

I created a test unit for a class and it passed well on my local, on sonarqube it is shown as 0% for Coverage, I found post advice to add coverlet.msbuild I added but still no news:

   <PackageReference Include="xunit" Version="2.4.1" />
   <PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
   <DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
   <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.0" />
   <PackageReference Include="coverlet.msbuild" Version="3.0.3">
     <PrivateAssets>all</PrivateAssets>
     <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> 
   </PackageReference>
 </ItemGroup>

Any idea?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Try adding the following to your .csproj

<PropertyGroup>
  <DebugType>Full</DebugType>
</PropertyGroup>

<PackageReference Include="Microsoft.CodeCoverage" Version="16.9.4" />
over 4 years ago · Santiago Trujillo Report

0

Can you try coverlet.collector instead of coverlet.msbuild? I have personally used coverlet collector several times successfully.

<PackageReference Include="coverlet.collector" Version="1.3.0">
     <PrivateAssets>all</PrivateAssets>
     <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

According to this GitHub issue.

Collectors are pretty new(last arrived) and are the best way to do coverage because are strictly integrated with vstest platform(dotnet test) and due to that is the default choice for every .NET core xunit project by Microsoft. So if you create xunit project Microsoft xunit template inject by design our coverage engine as first class coverage tool running with dotnet test --collect:"XPlat Code Coverage"

It may be possible that you are running into this known issue.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!