Unit Test Coverage not visible in Sonarqube - sonarqube

I am running analysis on my solution which contains a Unit Test project just like any other projects . But there is 'No Data' in Unit Test Coverage Widgets .But I can see the analysis if I open respective folder/file of UT . How can I see Unit Test Coverage details by adding widget.

I am not using any of these tools...i am running analysis with sonar scanner.
SonarQube doesn't generate code coverage data. It displays data provided by reports generated by other tools. You have to configure and execute any code coverage tool and then scanner will upload results to the server.
See how to do it for C#: Code Coverage Results Import (C#, VB.NET)
More about code coverage: Seeing Coverage

Related

gradlew connectedCheck does not generate coverage report

Why gradlew connectedCheck does not generate instrumental or UI test coverage reports? It does generate report but does not show any coverage. Is there an actual way to get the coverage from the instrumental and UI tests? I did not find any reference in official android testing guides/documentation.

Does SonarQube always require an external code coverage tool to show coverage on sonar server?

Does SonarQube always require an external code coverage tool like jacoco (Java), Coverage (python), gcov (c/c++), in order to show coverage on a sonar server?
SonarQube by itself doesn't do any coverage. Its the job for other tools like jacoco and others.
However SonarQube can gather the "results" relevant to the project quality (of course including coverage as an important code quality metric) of the build and allows tracking of the quality over time.
Usually you run coverage tool first, it "adjusts" the code, then you run the tests in the build. Coverage tool creates some results, and only after that you run sonar plugin that processes the results and sends to the sonar qube server.
So, to answer your question: Yes, without an external code coverage tool, sonar won't produce any coverage results, and no, it doesn't have a "default, built-in" coverage tool

In SonarQube, How to reference a folder located in Continuous Integration tool's server?

In sonarQube, how to reference the unit test report residing in the server pertaining to Continuous Integration tool? Please note that the sonarQube and CI tools are in different servers. This is needed to show unit test coverage in sonarQube.
Usually, the build of a project does operations like:
Checkout source code
Build source code
Run unit test and generate coverage reports
Run a SonarQube Scanner to trigger the analysis
All this happens within the CI server. This means that you just need to configure your SonarQube analysis to point to the local coverage report files that have been generate just before.
For example, take a look at the following project:
Sample project that reads coverage reports
, and especially to its sonar-project.properties file, in which you will see that coverage report files are referenced using relative paths.

SonarQube incremental analysis for C#.Net UnitTest

I am using SonarQube 4.3 version to show Unit tests and other code metrics analysis results. Now I am looking for incremental preview or mode for my analysis results as described here.
I am looking to see whether the last code checked-in has a 100% unit test coverage, no security violations and has other quality gates passed.
Currently sonar gives overall combined report for all the files within project. Can we have one for the changed files in the last build as well?

sonar code coverage is not displaying

Which plug-in needs to installed to get the code coverage metrics in sonar reports? It was working fine for previous version(3.7.3) and now I am using 4.1.1 I can only see the unit test coverage. I need both if possible.

Resources