Generation of reports

Note: This feature is not available for black box testing.

HTML/CSV report

The menu entry Reports > Generate HTML/CSV Report allows exporting code coverage statistics (per methods, source files, executions, and so on) of the selected executions in HTML format. It allows listing the manually validated and unexecuted code parts.

EMMA-XML report

Selecting the menu entry Reports > Export Statistics in EMMA-XML Format allows exporting code coverage statistics in EMMA-XML format. The output contains global statistics in a format that is compatible with EMMA. This allows using Coco in tools that provide support for EMMA, notably to give an easy way to use Coco with continuous integration servers like Jenkins CI.

EMMA defines four categories for coverage: classes, methods, blocks, and lines. With Coco they have the following meaning:

EMMA categoryMeaning
classesA class is considered executed if one of its method is called. Code which is not in a class is located in the class "" (empty).
methodsA method is covered if it was called.
blocksCode coverage at statement block level.
linesLine code coverage (if compiled with line coverage support).
conditionsDecision/Condition coverage (if compiled with Decision/Condition coverage support).

Coberatura XML report

The menu entry Reports > Export Statistics in Cobertura-XML Format allows exporting code coverage statistics in Coberatura-XML format. The output contains global statistics in a format that is compatible with Coberatura. This allows the use of Coco in tools that provide support for Coberatura, notably giving an easy way to use Coco with continuous integration servers like Jenkins CI and SonarQube.

The statistics in the Coberatura report are computed a little bit differently from the usual way due to the limitations of the report format. The report is in fact a combination of line and condition coverage.

Every statement block, decision and condition instrumentation is counted as a Coberatura-condition. The end of a function is e.g. marked as one condition to fulfill.

The report format also requires that each line with a condition is also instrumented at line coverage level. This is not always true (e.g. with empty functions), so in this case we artificially add some instrumentation values. Finally, if an instrumented statement spans more than one line, it is necessary to generate instrumentation data for each line.

All this has an impact on the computation of the statistics for classes, methods and sources, but the resulting values are comparable to those in the other report formats.

SonarQube XML report

The menu entry Reports > Export Statistics in SonarQube-XML Format allows exporting code coverage statistics in the SonarQube-XML format.

The report is mainly based on line coverage (lineToCover) and each line has additional properties indicating the branch coverage for that line (branchesToCover and coveredBranches). Every statement block, decision and condition instrumentation that is highlighted with the chosen coverage method in the main window is counted as a branch in the XML report.

JUnit Report

The menu entry Reports > Export JUnit Report allows exporting the test result as JUnit report. This report does not contain coverage data and only lists the test execution result (i.e. passed or failed) for each test item.

Text report

Clicking the menu entry Reports > Generate Text Report generates a small text report in the form of one line per executed/unexecuted item. A distinct line format can be specified for executed or unexecuted lines.

The following escape sequences are recognized:

  • %f: Absolute source code file name
  • %r: Relative to the current build directory source code file name
  • %l: Line number
  • %c: Column number
  • %m: Explanation
  • %t: Source code fragment
  • %e: List of tests executing the instrumentation

For example, setting the field Unexecuted Code Fragments to %f:%l: %m will create a text file which contains all unexecuted code parts. Each line will look something like this:

foo.cpp:55: Unexecuted: 'return;'

Coco v7.2.1 ©2024 The Qt Company Ltd.
Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.