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

Unknown macro: {spacejump}

of Clover, or visit the latest Clover documentation.

Produces an HTML report of Code Coverage for the given coverage database.

Usage

java com.atlassian.clover.reporters.html.HtmlReporter [OPTIONS] PARAMS

Note: in Clover 3.1.x and older a class was named com.cenqua.clover.reporters.html.HtmlReporter.

Params

-i, --initstring <file>

The initstring of the coverage database.

-o, --outputdir <dir>

The directory to write the report to. Will be created if it doesn't exist.

Options

-a, --alwaysreport

Forces a report to be generated, even if there is no coverage data. Defaults to 'false', i.e. a report with no coverage will abort generation.

-b, --hidebars

Don't render coverage bars.

-bw

Don't colour syntax-highlighted source — smaller HTML output.

-c, --orderby <compname>

Comparator to use when listing packages and classes. Default is PcCoveredAsc.
Valid values are:

  • Alpha — Alpabetical.
  • PcCoveredAsc — Percent total coverage, ascending.
  • PcCoveredDesc — Percent total coverage, descending.
  • ElementsCoveredAsc — Total elements covered, ascending.
  • ElementsCoveredDesc — Total elements covered, descending.
  • ElementsUncoveredAsc — Total elements uncovered, ascending.
  • ElementsUncoveredDesc — Total elements uncovered, descending.

-d, --debug

Switch logging level to debug.

-e, --showemptyShow classes/packages even if they don't have any statements, methods or conditionals. default is false

-f, --filter <string>

Comma or space separated list of contexts to ignore when generating coverage reports. Most useful one is "catch".
Valid values are "assert", "static", "instance", "constructor", "method", "switch", "while", "do", "for", "if", "else", "try", "catch", "finally", "sync", or the name of a user-defined Context. See Using Contexts.

-h, --hidesrc

Don't render source level coverage.

-if --includefailcoverage

Specifies whether or not to include coverage attributed to a test that has failed. If omitted, failed test coverage is not included. Default setting is 'false'.

-n, --nocache

Insert no-cache browser directives in html output.

-p, --sourcepath <path>

The source path to search when looking for source files.

-s, --span <interval>

Specifies how far back in time to include coverage recordings from. See Using Spans. Default includes "all coverage data found".

-si, --showinnerSince 3.2.0: Show inner functions in the report (like a lambda function inside a method).
-sl, --showlambdaSince 3.2.0: Show lambda functions in the report.
-su, --showunique

Calculate and show unique per-test coverage (for large projects can consume much memory and take a significant amount of time). Defaults to false.

Option available since Clover 3.1.5.

-t, --title <string>

Report title.

-tc, --threadcount <int>

Number of additional threads to be allocated to report generation. Default is 0.

-tw, --tabwidth <int>

The number of spaces to subsitute TAB characters with. Defaults to 4.

-v, --verbose

Switch logging level to verbose.

Return code

The HtmlReporter.main() calls System.exit() and returns a non-zero value in case of error during HTML report generation.

API Usage

HtmlReporter provides a simple API that accepts an array of strings representing the command line arguments and returns an integer result code. The following fragment illustrates use of the API:

import com.atlassian.clover.reporters.html.HtmlReporter;
import com.atlassian.clover.CloverStartup;
import com.atlassian.clover.Logger;

public class HtmlReportRunner {
    public void runReport() {
        CloverStartup.loadLicense(Logger.getInstance());
        String [] cliArgs = { "-i", "clover.db", "-o", "clover_html" };
        int result = HtmlReporter.runReport(cliArgs);
        if (result != 0) {
           // problem during report generation
        }
    }
} 

Examples

java com.atlassian.clover.reporters.html.HtmlReporter -i clover.db -o clover_html

Reads coverage for the Clover database "clover.db", and produces a report in the directory "clover_html".

 

java com.atlassian.clover.reporters.html.HtmlReporter -c ElementsCoveredAsc
      -t "My Coverage" -i clover.db -o clover_html

Produces the same report as above, but includes a report title, and orders lists by total elements covered rather than percentage covered.

 

  • No labels