lcov to Cobertura XML Converter

Converts lcov line coverage output to Cobertura-compatible XML for continuous integration

View the Project on GitHub eriwen/lcov-to-cobertura-xml

This project does as the name implies: it coverts code coverage report files in lcov format to Cobertura's XML report format so that CI servers like Jenkins can aggregate results and determine build stability etc.

Quick command-line usage

Grab it raw and run it with python:

python lcov_cobertura.py lcov-file.dat
python lcov_cobertura.py lcov.dat -b src/dir -e tests -o out.xml

Usage with Python 2 or 3

You can install lcov_cobertura with pip:

pip install lcov_cobertura

Then just use it anywhere in your python:

from lcov_cobertura import LcovCobertura

LCOV_INPUT = 'SF:foo/file.ext\nDA:1,1\nDA:2,0\nend_of_record\n'
converter = LcovCobertura(LCOV_INPUT)
cobertura_xml = converter.convert()
print cobertura_xml

License

This project is provided under the Apache License, Version 2.0.