Code coverage will not be imported for the following file outside of SonarQube

1,418 views
Skip to first unread message

Shani Shiri

unread,
Mar 6, 2016, 5:09:35 AM3/6/16
to SonarQube

i'm running SonarQube 5.2, Sonar runner 2.4, with OpenCover for code coverage. When running the Sonar for a project with OpenCover xml i'm getting the error below. The analyze is done in D:\sTFS\28983\Sources\ApplicationsLauncher\Source, and the coverage xml in D:\sTFS\28983\Sources\ApplicationsLauncher\Source\opencover1.xml. 

ApplicationsLauncher.UnitTests.cs file is not a shared one. 


16:40:03.802 INFO - Parsing the OpenCover report D:\sTFS\28983\Sources\ApplicationsLauncher\Source\opencover1.xml 16:40:03.802 DEBUG - Code coverage will not be imported for the following file outside of SonarQube: D:\sTFS\28983\Sources\ApplicationsLauncher\Source\ApplicationsLauncher.UnitTests\ApplicationsLauncher.UnitTests.cs


Any idea why the code coverage isn't shown?

Shani Shiri

unread,
Mar 29, 2016, 10:16:46 AM3/29/16
to SonarQube
Anyone?

בתאריך יום ראשון, 6 במרץ 2016 בשעה 12:09:35 UTC+2, מאת Shani Shiri:

Dinesh Bolkensteyn

unread,
Apr 6, 2016, 5:33:44 AM4/6/16
to SonarQube
Do you see code coverage on your SonarQube dashboard?

The logs you are looking at are the DEBUG level ones, which are useful only for the investigation of specific problems.

INFO level logs are meant to be read by end-users.

The SonarQube analysis is done one project at a time, and when project A is being processed, all code coverage infos found on project B are marked as being ignored.
Then, when the analysis moves on to project B, all coverage information found about project A will be marked as ignored this time.

But in the end, all projects should have their code coverage information properly imported, and you should be able to simply ignore these DEBUG level log messages.

Shani Shiri

unread,
Apr 25, 2016, 10:45:28 AM4/25/16
to SonarQube
Hi Dinesh,
thanks for the answer.
I can see the code coverage on your SonarQube dashboard, but the numbers are not align with VS code coverage (we use openCover for SonarQube).
As i understand, SonarQube show the code coverage from the tool we use, so mybe we are having a problem with openCover.
We will continue our investigation in this direction.
Thanks!

בתאריך יום רביעי, 6 באפריל 2016 בשעה 12:33:44 UTC+3, מאת Dinesh Bolkensteyn:

Dinesh Bolkensteyn

unread,
Apr 26, 2016, 2:49:50 AM4/26/16
to Shani Shiri, SonarQube
I wouldn't worry too much about very small differences.

SonarQube imports the data from OpenCover on a file level basis, but then, it does the folder & project aggregation by itself.

So these aggregated numbers might be different from what you see in OpenCover.

For example, if OpenCover knows about more files in your project than SonarQube, then you'll see a difference.

Let us know if you see differences in coverage on individual files, because that is not supposed to happen.

--
You received this message because you are subscribed to a topic in the Google Groups "SonarQube" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonarqube/HZ985f6Sb6s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/383044bc-d4a6-48c1-988f-c18c559f2d3b%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

pras....@gmail.com

unread,
Apr 29, 2016, 12:12:39 PM4/29/16
to SonarQube, shanis...@gmail.com
Hi Dinesh 
I am facing same issue , i can see my Parsing the Visual Studio coverage XML report in log which is generated using CodeCoverage.exe , I can see debug message Code coverage will not be imported for the following file outside of SonarQube: which i am going to ignore henceforth
but I am not able to see code coverage on sonar dashboard 
Could you please help

Thanks & Regards
Prashant

pras....@gmail.com

unread,
May 3, 2016, 4:45:03 AM5/3/16
to SonarQube, pras....@gmail.com, dinesh.bo...@sonarsource.com

Shani Shiri

unread,
May 5, 2016, 9:17:33 AM5/5/16
to SonarQube, shanis...@gmail.com
Hi Dinesh,
There is no differences in coverage on individual files, but the diffrences is that i see OpenCover includes the test dll's for the coverage calculation, 
while SonarQube doesn't (OpenCover shows 33.8% while SonarQube 8.6%).
Is it true? Is this a normal behavior?

 
בתאריך יום שלישי, 26 באפריל 2016 בשעה 09:49:50 UTC+3, מאת Dinesh Bolkensteyn:

Dinesh Bolkensteyn

unread,
May 9, 2016, 3:30:52 AM5/9/16
to Shani Shiri, SonarQube
Yes indeed, code coverage on test code is not taken into account to compute the code coverage numbers.

Why? You're writing tests to test the product code. You don't want to start to write tests to test the tests... Why? Because then you'd need to write test to test the tests to test the tests... and it would never end ;-)

Test projects tend to have 100% code coverage, so they will tend to artificially push the overall code coverage to higher levels if they are taken into account.

In the end, what matters is how well your product code is tested.


Reply all
Reply to author
Forward
0 new messages