Friday, 28 November 2014

Cobertura configuration with jenkins

 Follow below Steps to Integrate cobertura with Jenkins

  Step 1) - Install cobertura plugin in Jenkins

  You can install plugin through Manage Jenkins

   Click on Manage Jenkins --> Manage Plugins --> Available --> Search for cobertura
   plugin --> Click on check box--> On bottom of page you find two buttons to install the
   plugin choose which suites you.

   Skip first point if cobertura plugin already installed on your Jenkins.

   Step 2) - Enable Cobertura in projects

   A)- Choose desired Project on which you want to configure cobertura.
               Click on Configure :: refer image


   B)- Go to Build Section ::
     Add command in Goals and options
     cobertura:cobertura –Dcobertura.report.format=xml 
     cobertura:cobertura -  This command initiate coverage functionality.
     – Dcobertura.report.format=xml - From this we are specifying that we need
      coverage report in  xml format.Refer below image.







    C)- After that Go to Post-build Actions ::
            Select Option Publish cobertura coverage report
        If you have multi module project then surely you have several coverage.xml file in
        different folders, So to cover all we need to provide a general path, you can see in
        above SnagIt, I used   
        **/target/site/cobertura/coverage.xml,
        so it can cover all coverage file under different target folders.

  Step 3)- Creating Views for Cobertura ::

       Go to Jenkins dashboard a Click on + option as mention in below screen

       It open a window where you can enter view name and check view option

      After providing required information, Click on Ok button -  It open a configuration
      widgets,you can configure it as required,  Required to choose below two options
      You can select your preferred job from Job Filters section

       And also need to provide portlets position ,Please refer


Enjoy!!

1 comment: