Sonar doesn't show code coverage

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

Hi! We using SonarCube v 7.9.2 Data Center Edition

  • what are you trying to achieve

My aim is to build into jenkins pipeline code coverage reports sending to server.
Our project written on C#. I created simple library containing two classes and and unit test project which covers only one of them. Test framework is xUnit. Test project uses xunit.runner.visualstudio and coverlet.collector nuget packages.

  • what have you tried so far to achieve this

The problem is when execute LOCALLY script containing following commands:

`dotnet sonarscanner begin /d:sonar.cs.opencover.reportsPaths='Tests/**/coverage.opencover.xml' /d:sonar.cs.vstest.reportsPaths='Tests/**/TestResults.trx' (other params: sonar.host.url, sonar.login, /k:projKey, /n:projName, sonar.branch.name, sonar.sourceEncoding)`

dotnet build

dotnet test --logger "trx;LogFileName=TestResults.trx" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover

dotnet sonarscanner end /d:sonar.login='myToken'

everything works fine and I see LineCoverage 50%

But when I do same thing inside jenkins pipeline I see LineCoverage 0%, Lines to cover 0

hello, and welcome to the community, @vitaly

First of all, did you read the trouble shooting guide: [Coverage] Troubleshooting guide for .NET code coverage import? If yes, and tried out the advice there, then please :

  • tell us what you tried out from the trouble shooting guide
  • give us the verbose output of the END command (please run SonarScanner.MSBuild.exe begin /k:“MyProject” /d:sonar.verbose=true <other params> as the begin step, and please attach the output of the BEGIN and END steps), of the local build and the Jenkins one.

Thanks!
Andrei

Did you manage to fix your issues, @vitaly ?