Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branch (partial) coverage in cobertura report #430

Open
tmarti2 opened this issue Oct 11, 2023 · 0 comments
Open

Branch (partial) coverage in cobertura report #430

tmarti2 opened this issue Oct 11, 2023 · 0 comments

Comments

@tmarti2
Copy link

tmarti2 commented Oct 11, 2023

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant