Unable to see code code coverage while using sonar from jenkins pipeline

Must-share information (formatted with Markdown):

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

We are using Sonar 8.1 (community edition)

  • what are you trying to achieve
    We are having a .Net Project which we are doing a build and running test by jenkins pipeline job where we have integrated the sonar.
  • what have you tried so far to achieve this
    We have first build the project, executed the unit test and generated the .trx files and .coverage files, after that we are doing a sonar analysis with begin, build, test and end.
    but code coverage is showing 1.7%
    We are stuck on this for past 1 month without much progress.

I have used the link mentioned in sonarqube analysis for dot net code. But I am getting the below error.

WARN: Unable to locate ‘report-task.txt’ in the workspace. Did the SonarScanner succeeded?

ERROR: script returned exit code -1

hi @soumya1 and apologies for the delay.

Did you read the Code Coverage is not shown in the SonarCloud.io topic? Could you follow the advice given there to diagnose your problem?

Hi @Andrei_Epure,
I have followed the steps given in the topic, but still the coverage came only to 0.7%.

Regards,
Soumya

Hi @soumya1

  • what code coverage tool are you using?
  • what is the version of Scanner for MSBuild you are using?
  • are you still on SQ 8.1? it’s not a supported version, and we’ve improved our coverage logging in the newer versions.
  • are you running all commands from the same folder?
  • could you please share the the verbose output of the END command (please run SonarScanner.MSBuild.exe begin /k:“MyProject” /d:sonar.verbose=true as the BEGIN step, and please attach the output of END step)

Also, before replying, please read the new [Coverage] Troubleshooting guide for .NET code coverage import guide we have. It will make this conversation much more efficient.

Thanks,
Andrei

1 Like