![Converting JaCoCo test reports to Cobertura or Clover format](https://optimise2.assets-servd.host/gratis-creeper/production/blog/jacoco-banner.jpg?w=2500&h=1250&auto=compress%2Cformat&fit=crop&dm=1714055239&s=52c40f3afef905dee0f271fc71868cd4)
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.
![Make an AI Art Generating Slack Bot in 10 Minutes](https://optimise2.assets-servd.host/gratis-creeper/production/blog/1561099_new-blog-post-header-image_2_020623.jpg?w=696&h=320&q=75&auto=format&fit=crop&dm=1708017378&s=b6c9e56af248bab5ddca3dcceabc147a)
Make an AI Art Generating Slack Bot in 10 Minutes
February 3, 2023David shares how easy it is to create your own AI art generating Slack bot using Typescript and Stable Diffusion.
Read more![Kotlin Multiplatform](https://optimise2.assets-servd.host/gratis-creeper/production/blog/Kotlin-672x372.png?w=696&h=320&q=75&auto=format&fit=crop&dm=1708017572&s=f5746d00ba747618364626f9746b34f7)
Kotlin Multiplatform
July 14, 2022A brief look at Kotlin Multiplatform Mobile, a newer cross-platform mobile application framework.
Read more![Making your Android project modular with convention plugins](https://optimise2.assets-servd.host/gratis-creeper/production/blog/making-android-project-modular-thumbnail.jpg?w=1080&h=1125&auto=compress%2Cformat&fit=crop&dm=1716396338&s=fb077165b6a7953faa0485ceb3ab39f6)
Making your Android project modular with convention plugins
May 22, 2024Explore the journey of Gradle and build tools like it, particularly in the context of Android development. You'll learn the necessity of separating code into modules as projects grow and how Gradle convention plugins can streamline this process.
Read more