JSONReporter

On this page

Still need help?

The Atlassian Community is here for you.

Ask the community

Produces a JSON report of Code Coverage for the given coverage database.

Usage

 java com.atlassian.clover.reporters.json.JSONReporter [OPTIONS] PARAMS

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

Parameters

-i, --initstring <file>

The initstring of the coverage database.

-o, --outputdir <dir>

The output directory for generated JSON.

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.

-d, --debug

Switch logging level to debug.

-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'.

-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.
-tc, --threadcount <int>Number of additional threads to be allocated to report generation. Default is 0.

-v, --verbose

Switch logging level to verbose.

Return code

The JSONReporter.main() calls System.exit() and returns non-zero return code in case of error during JSON report generation.

API Usage

JSONReporter 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.CloverStartup;
import com.atlassian.clover.Logger;
import com.atlassian.clover.reporters.json.JSONReporter;

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

Examples

 java com.atlassian.clover.reporters.json.JSONReporter -i clover.db -o clover_json

Read coverage for the Clover database "clover.db" and produce a report in the directory "clover_json".

 

Last modified on Oct 22, 2013

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.