How to run Unit Tests with JaCoCo, Maven and IntelliJ IDEA

Ғылым және технология

🔍 Are you looking to level up your coding skills and gain a deeper understanding of testing in Java? Join us on a pragmatic journey to mastering JUnit 5 and JaCoCo.
🧰 In this video, we'll start from scratch in an empty Java project in IntelliJ. We'll show you how to set up JUnit 5, create test cases, and use JaCoCo to analyze your code coverage effectively.
🛠️ We'll keep it practical by demonstrating how to write test cases for various scenarios, including null input, empty strings, whitespace, and valid strings. You'll gain valuable insights into using JUnit 5's assert methods.
📊 We'll then dive into JaCoCo, a powerful tool for measuring code coverage. You'll learn how to configure it in your project's POM file, generate code coverage reports, and identify untested code branches.
📈 To ensure code quality, we'll set up a quality gate that requires a minimum of 90% code coverage for all packages. This is a crucial step in maintaining software quality standards.
💡 By the end of this video, you'll have a solid foundation in testing with JUnit 5 and a practical understanding of how to ensure comprehensive code coverage with JaCoCo.
Find the code on GitHub:
github.com/BeginSecure/JaCoCo...
#junit #jacoco #maven
=== Chapters ===
00:00 Introduction
01:36 Generate a test class with IntelliJ
03:00 Add JaCoCo to pom.xml
05:45 View code coverage report in JaCoCo
07:34 Add a Quality Gate with JaCoCo
09:50 Parameterize JUnit tests

Пікірлер: 13

  • @mihai6564
    @mihai6564Ай бұрын

    thanks for the video

  • @beginsecure

    @beginsecure

    Ай бұрын

    You're welcome, thanks for watching!

  • @develop-TC
    @develop-TCАй бұрын

    great!!

  • @beginsecure

    @beginsecure

    Ай бұрын

    Thank you so much for your support!

  • @parthasawant
    @parthasawant5 ай бұрын

    Concise, Focused, No BullShit 👍👍👍 Keep it up Man 👍

  • @beginsecure

    @beginsecure

    5 ай бұрын

    Awesome comment. Thanks for noticing. I respect your time!!

  • @amineamine2208
    @amineamine220815 күн бұрын

    Thank you so much for the video , i have a question please . what is the best sonarqube ou jacoco

  • @beginsecure

    @beginsecure

    15 күн бұрын

    Thanks for the question. It depends on what your goals are. JaCoCo is best for measuring test coverage, while SonarQube provides a broader range of static code analysis and integrates with JaCoCo for coverage metrics. Using both together gives you a complete picture of your code quality and test coverage. I would suggest using both.

  • @alejandrokovaltchuk8863
    @alejandrokovaltchuk88634 ай бұрын

    Excellent explanation, nice job!

  • @beginsecure

    @beginsecure

    4 ай бұрын

    I really appreciate your feedback! It means a lot to me.

  • @vireaksstorm5994
    @vireaksstorm59944 ай бұрын

    Thank you so much for the video. I have a few questions for parameterizeTest above your case. Do you have to try to update these reports to the Sonarqube to check for the test? If it works how to set things up and running with related POM includes: Surefire, Jacoco, and Sonarqube for the project?

  • @beginsecure

    @beginsecure

    4 ай бұрын

    Thank you for your feedback! Yes, you can update Jacoco test reports to SonarQube to analyze your test coverage. To set this up, you need to configure your project's pom.xml file to include the Surefire plugin for running tests, the Jacoco plugin for generating the coverage reports, and the SonarQube plugin to analyze and send these reports to SonarQube. You'll need to add the plugin configurations for each of these tools in your pom.xml and ensure they are correctly set up to interact with each other. For SonarQube, you'll also have to configure the sonar.projectKey, sonar.host.url, and sonar.login properties, potentially in a sonar-project.properties file or directly in your pom.xml. Good topic for a future video. Thanks for watching!

  • @vireaksstorm5994

    @vireaksstorm5994

    4 ай бұрын

    @@beginsecure Thank you for your information. I am waiting for your new video.

Келесі