Code Coverage Using Jacoco, Maven & Jenkins

Поділитися
Вставка
  • Опубліковано 5 лис 2024
  • Demo to showcase usage of Jacoco Tool for obtaining Code Coverage Report for a Maven based Java Project.
    Source code used for this tutorial : github.com/rch...

КОМЕНТАРІ • 15

  • @Gurudev031
    @Gurudev031 4 роки тому +2

    Very well explained in a humble way..
    It would be more better if you have shown the percentage of code covered in sonarqube..

  • @vickyhuang4440
    @vickyhuang4440 2 роки тому +1

    thank you for making the good video, the audio can be improved though.

  • @tusharpawar5610
    @tusharpawar5610 3 роки тому

    Very well explained.. but I am not getting post build option on my jenkins.. can you help ?

    • @crudsinfotechng8127
      @crudsinfotechng8127  3 роки тому +2

      For a typical Free Style Job, Post build action should show up by default, unless some recommended plugins failed to install during Jenkins installation. Can not think of any other reason why post build option can be missing in your Jenkins.

    • @tusharpawar5610
      @tusharpawar5610 3 роки тому

      @@crudsinfotechng8127 thank you so much.. while building No artifacts found that match the file pattern "**/Jacoco.csv" .. configuration error ? Getting this error

    • @crudsinfotechng8127
      @crudsinfotechng8127  3 роки тому

      @@tusharpawar5610 Can you please first try to verify your Maven set-up on your local box by just opening up a command prompt, cloning the Git Repo and then running the command >mvn package . Check if this works fine....later on you can try the same steps with Jenkins.
      Hope this helps.

  • @Rajesh-tq4kj
    @Rajesh-tq4kj 11 місяців тому

    Hi Sir,
    Actually got a requirement to implement jacoc code coverage we are using maven build tool and jenkins pipeline script, could you please help me

    • @crudsinfotechng8127
      @crudsinfotechng8127  11 місяців тому +1

      Hello @rajesh-tq4kj, generating jacoco code coverage through scripted pipeline is pretty straightforward and you can refer to this : raw.githubusercontent.com/rchidana/calcwebapp/master/Jenkinsfile
      Hope this helps.

    • @Rajesh-tq4kj
      @Rajesh-tq4kj 11 місяців тому +1

      @@crudsinfotechng8127 Thank you so much sir

    • @saiv5768
      @saiv5768 7 місяців тому

      And can you also share pom file..

  • @saiv5768
    @saiv5768 7 місяців тому

    Do you have jenkins script for jacoco cvg step

    • @crudsinfotechng8127
      @crudsinfotechng8127  7 місяців тому

      Not sure if I understood your question but if you are looking at Jenkins pipeline code snippet, you can autogenerate it from the Jenkins Pipeline snippet generator that is available for your Jenkins instance.
      However, for most cases, the following code snippet will work (as long as your maven project structure is not overly complicated):
      stage('Jacoco Reports') {
      steps {
      jacoco()
      echo "Publishing Jacoco Code Coverage Reports";
      }
      }
      Few more parameters can be specified and the complete list of supported parameters can be found here : www.jenkins.io/doc/pipeline/steps/jacoco/
      Hope this helps.

  • @madhurmaheshwari454
    @madhurmaheshwari454 3 роки тому

    Not able to get jacoco.exec file

  • @sametimetest1947
    @sametimetest1947 3 роки тому

    Nice video (Y) I have one question - In Jenkins how to fail the job, if any of the unit test cases are failed in jacoco report?

    • @crudsinfotechng8127
      @crudsinfotechng8127  3 роки тому

      Hello,
      If its a Maven Project and you want to set this as a Global configuration, you can set the following in Jenkins Configuration : -Dmaven.test.failure.ignore=false to Maven Project Configuration -> Global Maven_OPTS
      The same can also be achieved for a specific Job as well. Hope this helps.