aantron / bisect_ppx

Code coverage for OCaml and ReScript

Home Page:http://aantron.github.io/bisect_ppx/demo/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Branch (partial) coverage in cobertura report

tmarti2 opened this issue · 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 ?