Generation of reports
Note: This feature is not available for black box testing.
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.
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:
|classes||A class is considered executed if one of its method is called. Code which is not in a class is located in the class |
|methods||A method is covered if it was called.|
|blocks||Code coverage at statement block level.|
|lines||Line code coverage (if compiled with line coverage support).|
|conditions||Decision/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.
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.
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
%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;'