Unable to understand branch coverage and line coverage for Android in Dashboard

Hello,

We have integrated Clover for Android in Eclipse IDE. We are able to generate the html report of the project. But when we open the dashboard of that html page we are not able to see the line coverage and branch coverage of the overall project. It is giving the coverage as per the package or class . We need for the overall project.

Can you please help us how to read the dashboard and understand various aspects of it.

Help Appreciated.

Thanks!

Bhushan

3 answers

1 accepted

0 vote

Hi Bhushan,

The dashboard itself is not configurable, however you can configure content of detailed reports for packages and classes. In order to do this, you'd have to use Ant and generate HTML report outside Eclipse. The task can contain one or more elements and you can choose which metrics shall be displayed in the report. Please see https://confluence.atlassian.com/display/CLOVER/clover-report#clover-report-Columns for more details. If you'd like to learn more about metrics and reports, I suggest a following lecture:

* https://confluence.atlassian.com/display/CLOVER/About+Code+Coverage

* https://confluence.atlassian.com/display/CLOVER/1.+Clover+for+Eclipse+in+10+minutes

* https://confluence.atlassian.com/display/CLOVER/4.+Understanding+Reports

Cheers

We need the line coverage and branch coverage of the overall project.

0 vote

We need the line coverage and branch coverage of the overall project.

Strictly speaking, Clover does not have a line coverage metric. Instead of this, a statement coverage metric is available (which is quite similar in terms of granularity).

Another question is how do you interpret branch coverage - is it a coverage of branches only (i.e. decision blocks like "if") or is it a coverage of statements + branches. In my opinion it should be the latter one, but it's up to you.

In order to read coverage value for the whole project, you can generate XML report. In the beginning of the file you'll find a <project> tag, for instance:

&lt;coverage generated="1370605007732" clover="3.1.12"&gt;
   &lt;project timestamp="1370605007039"&gt;
      &lt;metrics conditionals="46" methods="31" classes="3" files="3" packages="1" coveredstatements="90" complexity="54" loc="285" ncloc="183" coveredmethods="31" coveredconditionals="39" statements="95" coveredelements="160" elements="172"/&gt;
...

You can calculate coverage as follows:

  • method coverage = coveredmethods / methods * 100%
  • statement coverage = coveredstatements / statements * 100%
  • branch coverage = (coveredconditionals + coveredstatements) / (conditionals + statements) * 100%
  • total coverage = coveredelements / elements

Note: a total coverage metric is described here.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

247 views 4 10
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you