Completely lost trying to collect Code Coverage

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve
  • what have you tried so far to achieve this

Hi All,

Using
SonarQube 7.9.4
Scanner-NETCORE3

Trying to get my SonarQube Projects to reflect the Code Coverage from Visual Studio Enterprise.
I’m having a heck of a hard time figuring things out.

I added CodeCoverage.exe to my path as well as vstest.console.exe.

I followed the command procedure (I think).
I ran this command first…

dotnet “C:\SonarScanner_MS_Build\Scanner-NETCORE3\SonarScanner.MSBuild.dll” begin /k:“DOR_API_COV_TEST” /d:sonar.cs.vscoveragexml.reportsPaths=“C:\Users\robarnes\Documents\Discovery\Centene\DOR\DOR_API\DOR_API_2020-10-30 13_42_00.coveragexml”

That ran fine.
Then I tried to run this command and I get file not found…

dotnet test DOR_API.coveragexml --collect “DotnetCodeCoverage” CodeCoverage.exe analyze /output: DotnetCoverage.coverage

I have formatted the I/P file name two dozen times and no matter what… Not Found

Any help = greatly appreciated.
-Ron

Hi @RoBarnes

Does the DOR_API_2020-10-30 13_42_00.coveragexml file exist on disk?

Hi Andrei!

Yes it does.
In the same directory as the *.sln
-Ron

I read your post better. From what I understand, the dotnet test command fails, right? I see you are passing the coverage.xml as a parameter to dotnet test… Please read the manual of the command: https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-test

dotnet test [<PROJECT> | <SOLUTION> | <DIRECTORY> | <DLL>]

Also, related:

Thank you Andrei,

I will re-read the manual and try again.

Regards,
-Ron