Code coverage is showing as 0.0% while i can see the code bugs, vulnerabillity and code smell issues

Iam using SonarQube * Developer Edition * Version 7.7
Code coverage is showing as 0.0%, but it was showing code bugs, vulnerabilities and code smell issues. How to solve this problem suggest me.

Welcome :slight_smile:

You didn’t provide details like language, i.e. Java, which build tool … etc.
Here is a great post that might help

There’s also a github repo with scanning examples
https://github.com/SonarSource/sonar-scanning-examples

and the sonarqube documentation
https://docs.sonarqube.org/latest/analysis/coverage/

Gilbert

Actually this JaCoCo plugin is already installed in my sonarqube, but code coverage is shown as 0.0% only
Iam using C# code and build tool: Visual studio
Is there any other solution to solve this.

Didn’t know about the language from your first post.
Jacoco is java related. For C# there are other tools available.

The sonarqube doc link i posted has:
sonar.cs.vstest.reportsPaths = Path to VSTest reports. …
sonar.cs.nunit.reportsPaths = Path to NUnit execution reports. …
sonar.cs.xunit.reportsPaths = Path to xUnit execution reports. …

So you have to use one of this tools.

1 Like

Hi
I have added this below given paths in sonarqube path of (Administration > Configuration > General Settings > C# ) and then i try to scan code again, this time there is no Overview displayed & it was showing “This project is empty.” in the overview page.
So can you help me out.

Hi,

try this:
stop Sonarqube
delete $SONARQUBE_HOME/data/es6 folder
start Sonarqube

this will cause a rebuild of index.

Gilbert

By doing this above mentioned step, all the data will be cleared in the sonarqube of different projects?

The data is in your database, so it won’t get lost.
From sonarqube docs, FAQ https://docs.sonarqube.org/latest/faq/

How do I trigger a full ElasticSearch reindex?

Currently, the only way to force a reindex is to:

  • Stop your server
  • Remove the contents of the $SQ_HOME/data/es6 directory
  • Start your server

Before doing this, you should be aware first that processes are in place on the SonarQube side that out-of-sync indices are detected and corrected, and second that a full re-index can be quite lengthy depending on the size of your instance.

1 Like

Are the reports generated in your build via running one of these:
VsTest, NUnit, xUnit ?

1 Like

NO, Reports are not generating.

OK, Sonarqube only consumes the reports created by VsTest, NUnit, xUnit.
If there are no reports, Sonarqube can’t show anything.

1 Like

can you send me the path, where to check these report.
I have checked in the particular project root folder, is that correct?

Actually to stop Server I was restarting the server in the sonarqube path (Administration > System>Restart Server). there was an error pop up displayed as “You are not authorized to access this page. Please log in with more privileges and try again.”
And to delete this $SQ_HOME/data/es6 folder in my ‘C’ drive, it was not deleting because some files are used by some process.
Don’t mine i am new to this sonarqube, so please help me out.

Sorry, i don’t have a clue about VsTest, NUnit, xUnit. Can’t help with this.
This thread might be useful

Restart does a restart, to be able to delete the /data/es6 folder you need to stop Sonarqube server.
If running via service, stop the service. After deleting es folder start the service again.

In Windows there is no .bat file to stop the sonarqube, as of to start “SonarStart.bat” file
So i am not able to stop the service. Restart option is there, but it was also showing an error like “You are not authorized to access this page. Please log in with more privileges and try again”.

If you’re running Sonarqube not as service but with batch file, use <ctrl> + <c> inside cmd to stop or
simply close the cmd window.
But as i wrote already, the problem seems there are no reports generated.
If no reports available, Sonarqube can’t consume and so no coverage in Sonarqube.

Hi

Please provide the procedure and requirements list to connect sonarqube * Developer Edition* local host from another system using web browser and how to publish/configure on windows IIS.

Hi,

your questions are not related to code coverage anymore.
Please create a new thread with your new questions, e.g. running Sonarqube
with IIS as reverse proxy … etc.

As mentioned in 14 reply, i have run “Visual Studio Code CoverageRun Unit Tests & Coverage”, but there is an error like “codecoverage.exe” is file is missing.
Here iam using visual studio professional version 2017. My query is "code coverage option will work in VS 2017 professional version or not)