Tests Coverage with Jacoco, Unit and Integration Tests | Spring Boot Backend #9.4

แชร์
ฝัง
  • เผยแพร่เมื่อ 14 ก.พ. 2021
  • In this video I show how to obtain the tests coverage with Jacoco, for both the unit and the integration tests. I show the configuration of the Surefire and Failsafe plugins to run the unit and integration tests separatly. And finally I show how to use the Surefire and Failsafe plugins to feed Jacoco.
    This is the fourth part of the ninth video of a playlist where I show how to create a Spring Boot Backend, how to create a website: • Spring Boot
    Content of the video:
    * how to configure the Surefire and Failsafe plugins;
    * how to configure Jacoco;
    * how to feed Jacoco with Surefire and Failsafe;
    * how to see the Jacoco results from a browser;
    * how to obtain the coverage percentage from the terminal.
    Command used in the video (you must replace > and < by their symbols, because TH-cam doesn't allow to print these symbols in the description): cat target/site/jacoco-ut/index.html |sed 's@\(.*\)Total</td><td class="bar">\(.*\)</td><td class="ctr2">\(.*\)</td><td class="bar">\(.*\)@\3@g'
    Repository: github.com/serlesen/backend-s...
    My NEW eBook: sergiolema.dev/git-book/
    Blog: bit.ly/47ornJL
    LinkedIn: bit.ly/41Nn61q
    Facebook: bit.ly/47rc9nh
    My Desktop:
    • Laptop: Macbook Pro 16' 2019
    • Gaming Chair: amzn.to/47Vu6ed
    • Mouse: amzn.to/3HoBwM1
    • Desk: amzn.to/48Tc5Oi
    • Screen: amzn.to/48VZkCL
    Icons:
    * Check Mark by kareemov1000 from the Noun Project
    * Cross by kareemov1000 from the Noun Project
    * report by Vectors Market from the Noun Project
    * config by Storm Icons from the Noun Project
    * Plug by Hare Krishna from the Noun Project
    * spy by Arafat Uddin from the Noun Project
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 22

  • @adribg
    @adribg 3 ปีที่แล้ว +2

    Thank you very much for your clear explanation!

  • @dinobulja
    @dinobulja หลายเดือนก่อน

    Thank you. Great video/explanation. But, it would be nice you added to this video also how to display code coverage in GitLab per unit and integration test and how to add visualization in gitlab. And also, how to call the pipeline jobs separately now that you have added the surefire and failsafe plugin.

    • @TheDevWorldbySergioLema
      @TheDevWorldbySergioLema  หลายเดือนก่อน

      That's a lot of topics for a single video 😅
      You can watch another video I have about Gitlab if you want more details about how to configure jobs: th-cam.com/video/bW7VMeSHFNg/w-d-xo.html

  • @2kiranns
    @2kiranns 2 ปีที่แล้ว

    This video was helpful for me to setup Jacoco. Thanks.

    • @TheDevWorldbySergioLema
      @TheDevWorldbySergioLema  2 ปีที่แล้ว +1

      Glad it helped you

    • @2kiranns
      @2kiranns 2 ปีที่แล้ว +1

      The final part of maven command execution should have been included in the video. Adding them for completeness:
      mvn clean test --> Runs unit tests and creates code coverage report for UT alone
      mvn clean verify -P integration-test --> Runs IT and creates code coverage report for both UT & IT
      mvn clean verify -P all-tests --> Runs all the tests & creates all the report

    • @TheDevWorldbySergioLema
      @TheDevWorldbySergioLema  2 ปีที่แล้ว

      Maybe you're right, but my goal was to show how easy is to obtain the unit and integration tests coverage. If the viewers want more information it's easy to find it in the Jacoco documentation.

  • @jeyakumarisundaram8811
    @jeyakumarisundaram8811 ปีที่แล้ว

    Thank you very much!!

  • @replikvltyoutube3727
    @replikvltyoutube3727 8 หลายเดือนก่อน

    Thanks for the video that better explain configuration in pom

  • @DinMamma002
    @DinMamma002 ปีที่แล้ว

    Does this also work if you make http requests to your web server instead of using MockMvc?

  • @rangalakshmir.t8541
    @rangalakshmir.t8541 11 หลายเดือนก่อน

    could you make a video for code coverage for maven multi module project?

  • @kushmishra9197
    @kushmishra9197 2 หลายเดือนก่อน

    I have two different repo - one containing integration tests and another the repo which needs to be tested. Can I know the test coverage of these integration tests ?

  • @808sprng
    @808sprng 10 หลายเดือนก่อน

    I wish it worked for me 🥶

    • @TheDevWorldbySergioLema
      @TheDevWorldbySergioLema  10 หลายเดือนก่อน

      I'm sorry, what's the problem? Maybe the version of the libraries I use in the video are not yet up to date