bisect_ppx icon indicating copy to clipboard operation
bisect_ppx copied to clipboard

Branch (partial) coverage in cobertura report

Open tmarti2 opened this issue 1 year ago • 0 comments

Cobertura supports partial coverage on conditions, with this format :

<line number="5" hits="1" branch="true" condition-coverage="50% (1/2)">
  <conditions>
    <condition number="0" type="jump" coverage="50%"/>
  </conditions>
</line>

Here's cobertura DTD:

  <!ELEMENT lines (line*)>

  <!ELEMENT line (conditions*)>
  <!ATTLIST line number CDATA #REQUIRED>
  <!ATTLIST line hits   CDATA #REQUIRED>
  <!ATTLIST line branch CDATA "false">
  <!ATTLIST line condition-coverage CDATA "100%">

  <!ELEMENT conditions (condition*)>

  <!ELEMENT condition EMPTY>
  <!ATTLIST condition number CDATA #REQUIRED>
  <!ATTLIST condition type CDATA #REQUIRED>
  <!ATTLIST condition coverage CDATA #REQUIRED>

Branch and coverage defaults to false and 100% meaning, unlike html report, we lose some information. I'm trying to understand how everything work in cobertura.ml (and util.ml) to see how to fix this, but I'm having trouble understanding how data are stored in coverage files, and how to extract branch coverage information. At the moment I just found how to hard print branch="true" condition-coverage="50% (1/2) for lines with partial coverage, but I don't know where I can find how to compute the condition-coverage field. Is it possible ?

tmarti2 avatar Oct 11 '23 08:10 tmarti2