Can't detect my tests coverage .Net core 8

Hi there,
I new with sonarqube, and im praticing some Demo Poc locally, using sonarqube community ruiing in Docker.
The problem here is, sonarqube It’s not detecting my unit test. In ReportGenerator show normally as i show in the print bellow.

but idk why, in sonarqube always is 0% for my entire tests.

These are the commands that i`ve used.
1 - dotnet sonarscanner begin /k:“DemoArchApi” /d:sonar.token=“”
2- /d:sonar.cs.vscoveragexml.reportsPaths=<project.test_dir>\TestResults*.coveragexml
3- dotnet test CleanArchIntegrantion.API.Test.csproj --collect:“Code Coverage”
4- dotnet build
4- dotnet sonarscanner end /d:sonar.token=“”

Hi @CesaragsUC, welcome to the community!

Two questions:

  1. You seem to have two Begin steps, is that normal?
  2. In your end step, you seem to be lacking a "" after the TestResults directory name. Is that the case or just a typo?

The scanner does not fail when it cannot find any coverage files, so a typo in the path might explain your issue.

Denis

Hi denis.troller, was my mistake when i where writing, i updated for the correct steps that i followed.

Sorry to insist on the naming, but I also see that the template for the file is *.coveragexml.
Is this another typo? I do not think this is the correct pattern for coverage files generated by dotnet test --collect.

Can you check that?

im my project i run the folow command, and then is generated a folder with a .coverage file extension : \TestResults\d1099ac8-0f75-49c7-ad72-359f40d58984

dotnet test CleanArchIntegrantion.API.Test.csproj --collect:“Code Coverage”

Your screenshot shows a .coverage extension, but your scanner command line states

/d:sonar.cs.vscoveragexml.reportsPaths=<project.test_dir>\TestResults\*.coveragexml

If that is so, then the scanner expects to find .coverage.xml files in the directory, which would explain why we do not find any and thus report no coverage.

thx, but i really dont know what happend.
i already try specify the correct file or extension.
\TestResults\61079ea3-e7b7-4292-a968-95df910ec028\coverage.cobertura.xml
then =>
dotnet sonarscanner begin /k:“DemoArchApi” /d:sonar.token=“sqp_82eef9f7d66e790e4d77362b7c8ac6c6c3dc8bcb” /d:sonar.host.url=“http://localhost:9000” /d:sonar.cs.vscoveragexml.reportsPaths=.\TestResults\f944bf47-4a3b-495b-a14c-82cb233dd961\coverage.cobertura.xml

but still not working

you have any discord to talk?

I just got by follow this documentantion.

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