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=coberturaConvert when required
Terminal
# lcov -> Cobertura
pip install lcov_cobertura
lcov_cobertura lcov.info -o cobertura.xmlGotchas
- coverage.py
xmloutput 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
How to Generate .NET Coverage With Coverlet in CIMeasure .NET coverage in CI with Coverlet via dotnet test, emitting Cobertura XML that ReportGenerator, Codec…
How to Import Coverage Into SonarQube in CIFeed an existing coverage report into SonarQube from CI by pointing the language-specific coverage property a…
How to Upload Coverage to Codecov in CISend a coverage report to Codecov from CI with codecov/codecov-action, providing the token so private repos a…