Monday, September 24, 2018

How to enable code coverage report using JaCoCo plug-in - Code coverage Report using JaCoCo, Maven and Jenkins - Code Coverage in Pipeline

Code coverage is important aspect for maintaining quality in Agile development. There are different ways to manage code quality. one of the effective ways is to measure code coverage by using plug-ins such as JaCoCo, Cobertura.

We will see how to enable code coverage for your Java project and view coverage report in Jenkins UI.

step # 1: Add Maven JaCoCo plugin in POM.xml under MyWebApp in bitbucket Repo


Step 2 : Add JaCoCo plug-in in Jenkins:

Step 3:

For Freestyle Job:
Enable in Jenkins job to view code coverage report by going to post build action and add Record JaCoCo coverage report

For Pipelines:
Add below code in your existing pipeline:

stage ('Code coverage') {

Step 4 : Run the job by clicking Build now

Step 5:
 Click on the job to view code coverage report.

No comments:

Post a Comment