JUnit Test- Code Coverage With Maven And Jacoco | Java Techie

Поделиться
HTML-код
  • Опубликовано: 25 янв 2025
  • НаукаНаука

Комментарии • 75

  • @saddammd
    @saddammd 3 года назад +2

    Tried copy pasting so many configurations only yours work. Thanks

  • @aggrawalnikhil02
    @aggrawalnikhil02 5 лет назад +8

    No rush, in a cool calm mode... thank you for explanation... As a layman I was able to understand it.

  • @hkmehandiratta
    @hkmehandiratta 2 года назад +2

    Thanks Java Techie. Like all your videos, this too is concise, worth every second spent. Thanks again for providing all this for free.

  • @naveenkumar-vb5st
    @naveenkumar-vb5st 2 года назад +1

    Wow, simple and clear , loved ur explanation

  • @ehsansasanian9653
    @ehsansasanian9653 3 года назад +1

    I always enjoy the way you explain and make it like a piece of cake. Thank you!

  • @yogeshchaudhari9971
    @yogeshchaudhari9971 5 лет назад +1

    Short and simple...one of the best tutorial.... thank you so much....

  • @bathulanagendra4621
    @bathulanagendra4621 6 лет назад +2

    Clean and clear explanation sir.liked it.

  • @rashmiranjan2590
    @rashmiranjan2590 5 лет назад +1

    Thanks Basant.. you explained very well..

  • @karnansooriyakumar8002
    @karnansooriyakumar8002 2 года назад +1

    Thank you for clear explanation

  • @mupparajusrinadh9026
    @mupparajusrinadh9026 6 лет назад +2

    Thanks Basant for the video

  • @MarianaBai-n3x
    @MarianaBai-n3x 9 месяцев назад +1

    Thank you for the video!

  • @siyedyoussef3202
    @siyedyoussef3202 6 лет назад +2

    Thanks sir we would love to see jacoco with sonar👍👍👍

    • @Javatechie
      @Javatechie  6 лет назад +1

      Jacoco with sonar already uploaded please cross check once

  • @dumnguy
    @dumnguy 4 года назад +1

    Awesome tutorial, man. Thank you so much.

  • @ChaseGouldMMA
    @ChaseGouldMMA 4 года назад

    @6:25 which repository do we find the plugin text which was copied? Thanks

    • @Javatechie
      @Javatechie  4 года назад +1

      Source code link mentioned in video description go to pom.xml and do copy and paste

  • @sureshmanne7245
    @sureshmanne7245 Год назад +1

    Any reason why you didn't use stringbuilder reverse method which comes from api directly ?

    • @Javatechie
      @Javatechie  Год назад +1

      No reason while explaining it . But never use SB to reverse a string as it will impact performance

  • @jogeshwarghosh5722
    @jogeshwarghosh5722 4 года назад +1

    Thank you sir for posting these videos.

  • @semhalredda3692
    @semhalredda3692 4 года назад

    Thank you, you explained it very clearly.

  • @freddyhaug9379
    @freddyhaug9379 2 года назад +1

    great video

  • @sujithg5873
    @sujithg5873 6 лет назад +2

    Very useful thanks

  • @b.vigneshhrithick6054
    @b.vigneshhrithick6054 4 года назад +1

    Very useful.. thank you..

  • @mahendram6850
    @mahendram6850 3 года назад

    Hi Java Techi,
    If you have already covered how to integrate jococo code coverage report to Jenkins can you please share video link?

  • @harshavardhanreddybommared4660
    @harshavardhanreddybommared4660 4 года назад +1

    Hello
    The explanation is crystal clear. I am facing an issue while running maven test.
    I am working on a maven multi module project and try to run the maven test.
    I shows the below warning message and the report is not generated.
    Classes in bundle 'core-module' do no match with execution data. For report generation the same class files must be used as at runtime.
    Please help me with this.
    Thanks in advance!

    • @Javatechie
      @Javatechie  4 года назад

      Are you trying to generate report for each module individually?

    • @harshavardhanreddybommared4660
      @harshavardhanreddybommared4660 4 года назад

      @@Javatechie No for one particular module alone where I have my backend code (Java Code)

  • @ManojKumar-jq2hx
    @ManojKumar-jq2hx 3 года назад +1

    clear explanation thank you, if any test case is fail then jacoco is not generating the report, so may i know how we can skip failed test cases, is there possibility for this

    • @Javatechie
      @Javatechie  3 года назад

      It should generate , did you compare with my source code and follow the same

    • @ManojKumar-jq2hx
      @ManojKumar-jq2hx 3 года назад +1

      @@Javatechie , thanks for quick replay, while running the first cmd only I got the build fail so that's why I didn't tried for sonar:sonar cmd. Now I have tried even after build fail also report got generated. Is there any way to skip failed cases because its causing build fail.

    • @Javatechie
      @Javatechie  3 года назад

      You can add vm argument Dskip.test

  • @farrukhahmedsid
    @farrukhahmedsid 6 лет назад +2

    Excellent, thanks

  • @shivammishra009
    @shivammishra009 5 лет назад +2

    Thanks for the video. :)

  • @Surround_things
    @Surround_things Год назад +1

    👌👌

  • @thanujames1668
    @thanujames1668 2 года назад +1

    Hi sir, Will jacoco reports will generate when a test case fail.

    • @Javatechie
      @Javatechie  2 года назад

      Yes it will

    • @thanujames1668
      @thanujames1668 2 года назад

      @@Javatechie may I know how

    • @thanujames1668
      @thanujames1668 2 года назад

      right now I could only generate reports when all the test cases are passed. I need to generate the jacoco reports even when some of the test cases fail. Do I need to add any dependency for it ?

  • @VishalVerma-vc6yt
    @VishalVerma-vc6yt 6 лет назад +1

    Thanks, it's useful.

  • @msapurvapahade
    @msapurvapahade 2 года назад +1

    what should be the code coverage percentage ideally?

    • @Javatechie
      @Javatechie  2 года назад

      It depends on Rule set on coverage

  • @sugandhashukla5783
    @sugandhashukla5783 4 года назад

    nice explanation , thanks... :)

  • @anafro_ru
    @anafro_ru 11 месяцев назад

    Thank you so much!

  • @payalsinha1248
    @payalsinha1248 Год назад

    Sir, in my project I have to find the code coverage of integration test cases written in cucumber, but we have 2 different projects one is for source code and the another is for cucumber, can u plz suggest me how to generate the report in this scenario

  • @azimsurani4246
    @azimsurani4246 4 года назад +1

    Can you do it for JUnit 5 because I am struggling to implement the same with Junit 5?

  • @motolola
    @motolola 5 лет назад

    Very nice, and simple explanation ... How do we fail Maven build when a certain level of coverage is not met? Thanks in advance.

    • @Javatechie
      @Javatechie  5 лет назад +1

      Hi Akinjide,
      Thanks dude , didn't get you could you please elaborate more

    • @motolola
      @motolola 5 лет назад

      @@Javatechie Normally, when you run "mvn clean install" the project builds successfully if conditions like test cases etc passes ... I was wondering how to add more conditions like "if test coverage is lower than xx%, fail the build", maybe another condition like "Checkstyles, "PMD" etc ... How to include with maven build. Thanks for your quick and awesome response. you are touching lives.

  • @krypton2295
    @krypton2295 5 лет назад +3

    Unable to generate the html report

    • @Javatechie
      @Javatechie  5 лет назад

      Please check in your target folder

    • @krypton2295
      @krypton2295 5 лет назад

      @@Javatechie I checked. It's not there ☹️

    • @Javatechie
      @Javatechie  5 лет назад

      Run Maven install then refresh your project once please

  • @dloquer6989
    @dloquer6989 4 года назад +1

    THANKS!!! YOU WAS SAVE ME

  • @sivasiva-wn6os
    @sivasiva-wn6os 4 года назад

    Bro mine is showing zero clasess covered how to get it done

  • @MohdSalman-xq1cw
    @MohdSalman-xq1cw 5 лет назад +1

    Cool..............

  • @ujefmalek77
    @ujefmalek77 Год назад

    great thanks

  • @rezanhannan2939
    @rezanhannan2939 4 года назад +1

    I did not have the folder my-reports!!! how to solve it

    • @Javatechie
      @Javatechie  4 года назад

      Did you specify any directory in pom.xml ?

    • @rezanhannan2939
      @rezanhannan2939 4 года назад +1

      @@Javatechie target/my-reports

    • @Javatechie
      @Javatechie  4 года назад

      It should create this folder inside your target folder
      Can you copy Jacoco plugin from my code .

    • @rezanhannan2939
      @rezanhannan2939 4 года назад

      @@Javatechie here is the code
      org.jacoco
      jacoco-maven-plugin
      0.8.3


      prepare-agent

      prepare-agent



      report
      prepare-package

      report



      post-unit-test
      test

      report



      target/jacoco.exec

      target/my-reports





      target/jacoco.exec

  • @muralijava552
    @muralijava552 3 года назад

    could you please make a video, how to set the threshold for junit(if JUnit coverage falls below certain threshold)

    • @ruchiSAHAY11
      @ruchiSAHAY11 2 года назад

      Hi..were you able to find a solution to this?

  • @kasthurirengansrinivasan7183
    @kasthurirengansrinivasan7183 3 года назад +1

    thanks boss

  • @amitKumar-gv1eb
    @amitKumar-gv1eb 4 года назад +1

    But you none of your examples start from adding any dependies or other things from scratch .you use to just start from middle

    • @Javatechie
      @Javatechie  4 года назад

      No which video you are talking about ?

  • @muralijava3603
    @muralijava3603 4 года назад +1

    If I have a multiple packages, how can i exclude one package from report...I could able to execute by excluding...but report getting the excluded package...any help..?

    • @Javatechie
      @Javatechie  4 года назад

      In pom there should be some options please checkout maven repository and modify

    • @muralijava3603
      @muralijava3603 4 года назад +1

      @@Javatechie Thanks

  • @malius97
    @malius97 5 лет назад

    Thanks

  • @parttime-teach
    @parttime-teach 2 года назад

    champesav