Skip to content
This documentation applies to Codacy Self-hosted v3.0.0

For the latest updates and improvements, see the latest Cloud documentation instead.

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

Share your feedback 📢

Did this page help you?

Thanks for the feedback! Is there anything else you'd like to tell us about this page?

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

Alternatively, you can create a more detailed issue on our GitHub repository.

Thanks for helping improve the Codacy documentation.

If you have a question or need help please contact

Last modified September 9, 2020