Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Issue on Coberura Plugin. #3039

Mohtadi ·
Hi Team,

I use Cobertura Plugin to display some code coverage result. To generate the code coverage i use GCOV (tool included on GCC) and to generate the XML for Cobertura i use LCOV script which is a script dedicated to transform the standard output of gcov to Cobertura xml format.
This XML is displayed correctly on the graphical interface but i have a problem with the overview part. The Package Line Coverage and the Branch Coverage are wrong.
on the XML i have :

<package branch-rate="0.127646195766" line-rate="0.42970027248" name="src">
<classes>
<class branch-rate="0.272222222222" complexity="0" filename="src/AssociatedData.cpp" line-rate="0.622406639004" name="src.AssociatedData_cpp">
<methods>
<method hits="1" name="gtmdcme::FutureOptionUnderlyingBuilder::FutureOptionUnderlyingBuilder(gtmdcme::MessageHandler*, gtmdds::ILogger*, gtmdbase::IInstrumentManager*, gtmdcme::Configuration*) " signature="">
<lines>
<line branch="false" hits="1" number="9"/>
<line branch="false" hits="1" number="11"/>
<line branch="false" hits="1" number="12"/>
<line branch="false" hits="1" number="13"/>
<line branch="false" hits="1" number="14"/>
<line branch="false" hits="1" number="15"/>
</lines>
</method>

to recap the Line Coverage is : 42.98% and the Branch Coverage is : 12.77%
but on the graphical interface i Have the Line Coverage equal to 70.02% and the Branch Coverage equal to 27.22%

my question is: why i haven't the same value between the XML and the overview on graphical interface?

thx,
--Mohtadi
  • replies 5
  • views 2812
  • stars 0
steveluo ADMIN ·
QuickBuild doesn't use the value of branch-rate or line-rate you highlighted, instead, it will calculate the coverage data based on lines detected, lines total, branches detected and branches total from the XML.

For example, lines total is the count of all <line> elements, and lines detected is the count of all <line> elements with hits > 0.

If these data are not same as you highlighted, it may be the algorithm you used is different.
drdt ·
But, why is this value different? I would expect the calculations by Cobertura and by QuickBuild to be at least similar... this looks like a huge discrepancy.
Is there something wrong with Cobertura's internal calculations?
steveluo ADMIN ·
Do you encounter the same problem?

Actually, the data from QuickBuild is very close to the Cobertura report as long as you are using Cobertura to generate the original report. QuickBuild is using the same algorithm as Cobertura.

Here, in @Mohtadi's case, the issue is that the original reports are not generated by Cobertura, and I think the XML generated by GCOV and LCOV is not very accurate as what Cobertura does.
drdt ·
Okay, thanks. The discrepancy just had me alarmed. @Mohdati, have you tried using Clover format instead of Cobertura/? In the past I have found it to be superior to Cobertura for C++.

In my test case, I am taking cobertura results and directly feeding them into the Cobertura plugin for QuickBuild. I see 3% on the Cobertura report page and 2% on the overview page. Even this small difference had me alarmed, but it turns out my coverage is 2.99%, which is rounded down in one place and up in the other. I think this may be a bug.
steveluo ADMIN ·
@drdt, you are right, coverage data are rounded down in dashboard page and rounded up in report page, this is a bug, I filed this issue below and will get it fixed in next patch release, thank you.

http://track.pmease.com/browse/QB-2383