Sonarqube overall coverage showing 0%

SonarQube - Community EditionVersion 9.2.4 (build 50792)LGPL v3
Scanner - sonar-scanner-net46
OpenCover - 4.7.1221
Jenkins - 2.204.5

Projects:
Hangfire.Jobs - .NET Framework 4.7.2
Hangfire.Model - .NET Framework 4.7.2
Hangfire.Repository - .NET Framework 4.7.2
Hangfire.Service - .NET Framework 4.7.2
Hangfire.UnitTest - .NET Framework 4.7.2

This is my jenkins file:
jenkinsfile.groovy.txt (2.2 KB)

I am trying to generate an “Overall - Coverage” details from my test project, but even after a lot attempts I’m still getting 0% of covering test.
The file .xhr containing the quantity of test is showing up fine, on total 66 tests as the images show.
I followed some tracked issues on Github pages and Sonar.community but no success unfortunally.
Hope somebody have a tip or facing the same issue for give me any advice



Hey there.

What are the scanner logs telling you? Look for information along these lines:

13:23:38.857 INFO: Sensor C# Tests Coverage Report Import [csharp]
13:23:38.858 INFO: Parsing the Visual Studio coverage XML report d:\support\Scanner\coveragebug\ConsoleApp1\vs.coveragexml
13:23:38.861 INFO: Adding this code coverage report to the cache for later reuse: d:\support\Scanner\coveragebug\ConsoleApp1\vs.coveragexml
13:23:38.864 DEBUG: Found some coverage info for the file 'D:\support\Scanner\coveragebug\ConsoleApp1\ConsoleApp1\Program.cs'.
13:23:38.865 INFO: Sensor C# Tests Coverage Report Import [csharp] (done) | time=8ms

Hello Colin, thanks for help me out.

I am not sure about the track you need, but I faced this log

INFO: Sensor C# Tests Coverage Report Import [csharp]
INFO: Parsing the OpenCover report E:\Jenkins\workspace\HAN-6_SonarScan\report.coverage.xml
INFO: Adding this code coverage report to the cache for later reuse: E:\Jenkins\workspace\HAN-6_SonarScan\report.coverage.xml
INFO: Coverage Report Statistics: 121 files, 111 main files, 111 main files with coverage, 10 test files, 0 project excluded files, 0 other language files.
INFO: Sensor C# Tests Coverage Report Import [csharp] (done) | time=1369ms
INFO: Sensor C# Unit Test Results Import [csharp]
INFO: Parsing the Visual Studio Test Results file ‘E:\Jenkins\workspace\HAN-6_SonarScan\coverage.trx’.
INFO: Sensor C# Unit Test Results Import [csharp] (done) | time=15ms
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=0ms
INFO: CPD Executor 7 files had no CPD blocks
INFO: CPD Executor Calculating CPD for 79 files
INFO: CPD Executor CPD calculation finished (done) | time=78ms
INFO: Analysis report generated in 313ms, dir size=1.7 MB
INFO: Analysis report compressed in 930ms, zip size=550.5 kB
INFO: Analysis report uploaded in 78ms
INFO: ANALYSIS SUCCESSFUL, you can browse http://[url]/dashboard?id=HAN-6
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at http://[url]/api/ce/task?id=AX4jriVL4bLWae_woKI1
INFO: Analysis total time: 28.783 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 30.890s
INFO: Final Memory: 14M/54M
INFO: ------------------------------------------------------------------------
The SonarScanner CLI has finished
03:02:06.603 Post-processing succeeded.

If is not enough, please let me know. Thanks again.

Hm. That’s pretty surprising to see, since the logs would indicate coverage was well imported.

I have two follow-up questions:

  • In the screenshot, you shared there’s a :warning: warning (“Last analysis has 1 warning”). Click on it – what does it say?
  • Clicking over to the Code tab of your project, are there Lines of Code being reported for C# files you expect to see coverage on?

Hello Colin.

In your first question, this is the message what my application is showing on alert:

Is there something what I should be configured with nodejs? I did not see any about this in other threads.

In your second question, I do not cleary understand your meaning, but in my thought the coverage lines percentage should be changed according to my test implementation project, or am I wrong? Am I on a correct tought line? You can check the Code tab detailed on image bellow.

Please let me know if something else can be checked, I really appreciate that.
My best regards.

Hello Colin.

I appreciate your help in this case, but I found the issue that I was facing.
After replace the vstest path “/d:sonar.cs.vstest.reportsPaths=“E:\Jenkins\workspace\HAN-6_SonarScan\coverage.trx”” and put the xunit path “/d:sonar.cs.xunit.reportsPaths=“E:\Jenkins\workspace\BRANCH-6_SonarScan\report.tests.xml”” the sonar started to recognizing the line coverage as you can see.

I think this thread can be closed, I just do not know how.

Thanks again.

Hi @Raythan_Machado,

You can mark any post in this thread as the solution, which will then automatically close the thread after a few days.

Hello Chris, thanks for the tip.

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