This is the documentation for Clover 3.3. View this page for the

Unknown macro: {spacejump}

of Clover, or visit the latest Clover documentation.

'Current' Clover reports display graphical and numerical data relating to the most recent coverage data collected for the project.


The screenshot below shows a generated HTML report in a browser.

  • In the top left-hand corner is the list of packages. You can view all classes in the project or select a particular package to view. Clicking on the name of a package will bring up the relevant classes in the frame below it. Selecting one of these classes will bring up the source code in the frame on the right.
  • The header provides summary information relating to the current project. The left hand side displays the report title and the time of the coverage contained in the report. For current reports, the timestamp is the timestamp of the most recent run of tests. The right hand side of the header displays metrics for the package, file or project overview which is currently selected. Depending on the current selection, the metrics include all or a subset of:
    • Number of Lines of Code (LOC)
    • Number of Non-commented Lines of Code (NCLOC)
      (info) This information is currently not available with Clover reports on Groovy code.
    • Number of Methods
    • Number of Classes
    • Number of Files
    • Number of Packages.
  • Test coverage is indicated by colour-coding. For details, click 'SHOW HELP' in the report header.
  • Inline help appears when you mouse-over any column header, button, etc.

 

The screen shot shows the report for the Money.java source file with the green and red bar at the top showing the amount of code coverage on this class. The method, statement and conditional coverage percentages are beside this.

The left-most column shows line numbers. The second column shows the number of times a particular line has been executed during the test run. As you can see, lines 15-17 have been run 156 times by the JUnit tests, whereas line 28 has only been run twice.

If a line is never executed or has only been partially executed, the entire line of code will be highlighted in red. Depending on your browser, you can hover the mouse over a line to get a popup describing in detail the coverage information for that line. The following screenshot shows the coverage on a section of the MoneyBag.java source file:

Although line 52 of the above MoneyBag class has been executed 14 times, the method isZero() has never evaluated to true so it has not been fully tested. Therefore it, and the following two lines, are highlighted. This is also the case with lines 58 and 59.

This highlighting feature makes it easy for you to see which parts of the code have not been fully exercised by your tests so that you can then improve testing to provide better code coverage.

If any of the lines shaded red contained a bug, they may never be detected because the tests as they are don't test those parts of the code.


If you click on a [+] button on the left side of the class name, table will expand and show methods declared in it. If the HTML report was generated with showLambdaFunctions=true and showInnerFunctions=true options, the table will also show lambda functions declared inside methods or assigned to a class field.

Screen shot: sample report for code containing lambda functions

Naming convention for lambda functions is as follows: <lambda_prefix><parameter_list><sequence_number> where:

  • <lambda_prefix> is $lam
  • <parameter_list> is a list of argument names separated by underscore, like x_y_z; list can be empty
  • <sequence_number> is #N where N counts definitions of a lambda function in given source file (starting from 0)

For example:  $lam_x_y_z#6 means a sixth lambda in the source file having the (x, y, z) => signature.