CoberturaBranchCoverage Metric

Metric that measures the code coverage of branches (conditionals) based on a Cobertura coverage XML file.

Implemented by the org.gmetrics.metric.coverage.CoberturaBranchCoverageMetric class.

Metric Properties

The following properties can be configured for this metric within a MetricSet. See Creating a MetricSet for information on the syntax of setting a metric property.

PropertyDescriptionDefault Value
enabledThis boolean property controls whether the metric is enabled. If set to false, then the metric is not included as part of the results or the output reports.true
functionsThis List<String> property contains the names of the functions to be calculated at the class and package levels and (potentially) included within the report(s). Valid values are: - "total" - "average" - "minimum" - "maximum"["total","average"]
coberturaFileThe path to the Cobertura XML file. By default, the path is relative to the classpath. But the path may be optionally prefixed by any of the valid java.net.URL prefixes, such as "file:" (to load from a relative or absolute path on the filesystem), or "http:". This property is REQUIRED.N/A
packageNamePrefixesOptional, comma-separated list of prefixes that should be stripped from full path names before checking the Cobertura XML file for matching coverage information. For instance, if the GMetrics Ant task is configured to pull in all *.groovy files from "src/main/groovy/**", then all of the package paths will be prefixed with "src/main/groovy", which is not part of the actual package name recorded in the Cobertura XML file. In that case, set the packageNamePrefixes property to "src/main/groovy".null

References

  • Cobertura -- Cobertura is a free Java tool that calculates the percentage of code accessed by tests. It can be used to identify which parts of your Java program are lacking test coverage.