Posts

Showing posts with the label Cobertura

Cobertura Code Coverage Report For Jenkins Pipeline Jobs

Answer : There is a way to add a pipeline step to publish your coverage report but it doesn't show under the BlueOcean interface. It will show fine in the normal UI. pipeline { agent any stages { ... } post { always { junit '**/nosetests.xml' step([$class: 'CoberturaPublisher', autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: '**/coverage.xml', failUnhealthy: false, failUnstable: false, maxNumberOfBuilds: 0, onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false]) } } } Note that one of the parameters to the Cobertura plugin is the XML that it will use ('**/coverage.xml' in the example). If you are using python, you will want to use something like: nosetests --with-coverage --cover-xml --cover-package=pkg1,pkg2 --with-xunit test Nowadays you can also use the cobertura command directly in a Jenkinsfile stage ("Extract...