Skip to content
Latchkey

How to Convert Between lcov, Cobertura, and coverage.xml in CI

Upload tools each prefer certain formats, so know which your generator emits and how to convert.

lcov (lcov.info) is the JS/C default, Cobertura XML is common for Python and .NET, and JaCoCo has its own XML. When a tool needs a format you do not have, convert with a small utility.

Emit the format you need

Terminal
# Python: Cobertura-style coverage.xml
coverage xml -o coverage.xml

# Node: lcov
npx c8 --reporter=lcov

# .NET: Cobertura via Coverlet
dotnet test /p:CoverletOutputFormat=cobertura

Convert when required

Terminal
# lcov -> Cobertura
pip install lcov_cobertura
lcov_cobertura lcov.info -o cobertura.xml

Gotchas

  • coverage.py xml output is Cobertura-compatible, so "coverage.xml" and "Cobertura" often mean the same file.
  • Converting can lose branch detail; prefer emitting the target format directly when the generator supports it.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →