Skip to content

Generating coverage reports

Code coverage is a metric used to describe the degree to which the source code of a program is tested. A program with high code coverage has been more thoroughly tested and has a lower chance of containing software bugs than a program with low code coverage. You can read more about the basics of code coverage on our blog.

There are many tools that you can use to generate coverage reports for the languages used in your repositories. The following table contains example coverage tools that generate reports in formats that Codacy supports:

Language Example coverage tools Report formats
C# OpenCover
dotCover CLI
dotCover detailedXML
Java JaCoCo
JavaScript Istanbul
Mocha + Blanket.js
PHP PHPUnit PHPUnit XML (version <= 4)
Python Cobertura
Ruby SimpleCov Cobertura
Scala sbt-jacoco
Swift/Objective-C Xcode Code Coverage See below how to generate coverage reports with Xcode

Swift and Objective-C support

To use Swift and Objective-C with Xcode coverage reports, use Slather to convert the Xcode output into the Cobertura format.

To do this, execute the following commands on the CI:

gem install slather
slather coverage -x --output-directory <report-output-dir> --scheme <project-name> <project-name>.xcodeproj

This will generate a file cobertura.xml inside the folder <report-output-dir>.

After this, run Codacy Coverage Reporter to upload the coverage results to Codacy.


Did this page help you?

Thank you for the feedback!

We're sorry to hear that. Please let us know what we can improve.

If you have a question, please ask our community or contact

Last modified January 26, 2021