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

Hey @RoBarnes - did you fix your problem, in the end?

Hi Andrei,

I did re-read the manual and I did re-try my procedure.
It still failed. I was able to work around the issue using Visual Studio Enterprise and taking the code coverage details from there and creating the Client Deck.
I know for sure I am doing something wrong.
When I have time again to resume this issue, I will update the thread.

Thank you very much for all the time you spent with me!

Regards,
-Ron

1 Like

Ok, I’m glad to hear you managed to import code coverage.

From what I understand , you managed to collect code coverage via the Visual Studio Enterprise code coverage tooling. Can we mark this topic as solved? Or do you want to keep it open for using the dotnet tool?

It can be marked as Solved.
If I run into issues again, I will re-post.

Thank you Again.

Regards,
-Ron

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.