![Converting JaCoCo test reports to Cobertura or Clover format](https://optimise2.assets-servd.host/gratis-creeper/staging/blog/jacoco-banner.jpg?w=2500&h=1250&auto=compress%2Cformat&fit=crop&dm=1714055239&s=8c914df4e5dd0ba5bd4c105ee73df3d6)
The Java Code Coverage (JaCoCo) framework is an excellent tool to generate test coverage reports for your Android Gradle project. Sometimes you’ll need your test coverage reports in another format, such as Cobertura or Clover (used by Atlassian tools to track test coverage). We use Atlassian Bamboo to automatically build our projects and perform code tests, so we needed to convert our Android project test coverage reports from JaCoCo format to Clover format. This way, we could benefit from Bamboo’s ability to track test coverage per build and over time.
Here’s what a test coverage summary looks like in Atlassian Bamboo:
![](/uploads/blog/posts/clover_test_coverage.png)
Converting from JaCoCo to Cobertura
Thanks to a simple Python script from this Github repository you can easily convert your JaCoCo test coverage reports to Cobertura format.
In your app’s base directory, run these shell commands to create a Cobertura reports directory alongside your Jacoco reports directory and then perform the conversion.
mkdir -p ./app/build/reports/cobertura python cover2cover.py ./app/build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml src/main/java > ./app/build/reports/cobertura/coverage.xml
Converting from Cobertura to Clover
Converting from Cobertura test coverage format to Clover format is done with the cobertura-clover-transform Python tool.
Run this shell command to use the Python package installer tool pip to install the cobertura-clover-transform tool.
pip install lxml cobertura-clover-transform
In your app’s base directory, run these shell commands to create a Clover reports directory and then perform the conversion from Cobertura to Clover.
mkdir -p ./app/build/reports/clover python -m cobertura_clover_transform.converter ./app/build/reports/cobertura/coverage.xml > ./app/build/reports/clover/clover.xml
Looking for more like this?
Sign up for our monthly newsletter to receive helpful articles, case studies, and stories from our team.
![UX Writing Tips](https://optimise2.assets-servd.host/gratis-creeper/staging/blog/UX-Writing-Tips.jpg?w=696&h=320&q=75&auto=format&fit=crop&dm=1708017708&s=f4f79fca31fa43ea4a32e0c3405789e4)
UX Writing Tips
February 3, 2023Kai shares a few tips he's collected on how to write for user interfaces.
Read more![The value of AR for business leaders (and when not to bother)](https://optimise2.assets-servd.host/gratis-creeper/staging/blog/vision-pro-thumbnail.jpg?w=1080&h=1080&auto=compress%2Cformat&fit=crop&dm=1713966581&s=a339ff859c5b90d2331d8d95ff5e91c1)
The value of AR for business leaders (and when not to bother)
April 24, 2024Should you leverage AR for your new digital products? Should you build an app for Apple’s Vision Pro? Discover four common use cases for AR and when to focus your energy elsewhere.
Read more![Automatic artifact downloads inside PR comments](https://optimise2.assets-servd.host/gratis-creeper/staging/blog/automatic-artifacts-thumbnail.jpg?w=1080&h=1080&auto=compress%2Cformat&fit=crop&dm=1718905906&s=8d3b105c2c2ee23c5ae17003fdb876d9)
Automatic artifact downloads inside PR comments
June 20, 2024Discover a method to streamline the process of accessing build artifacts from GitHub Actions by reducing the number of clicks needed to download them directly from a pull request (PR) comment.
Read more