
Master JUnit 5 for Java developers teaches how to test features, enable or disable tests, run them repeatedly with specific parameters, and prevent regressions when merging into larger code bases.
Understand JUnit's architecture with three components: the basic platform to run tests, the Jupiter extension for Java 8 features, and the G-Unit Windage module for backward compatibility.
Set up your Java development environment by choosing Java 11 LTS (or Java 17), installing from Oracle or OpenJDK vendors, and configuring Eclipse IDE with a workspace and compiler settings.
Explore your first JUnit 5 test case, and compare two project setups: a simple Eclipse Java project and a standard Maven-based workflow to be covered in the next lecture.
Create and organize JUnit tests with a custom folder structure, configure JUnit libraries, write a @Test method, and run tests to observe a forced failure in this example.
Create a Maven project for a Java arithmetic calculator and configure JUnit Jupiter dependencies. Write and run basic test cases for add, subtract, multiply, divide, and modulus.
Explore the JUnit 5 lifecycle annotations that manage setup, execution, and cleanup phases: before all, before each, after each, and after all, to initialize resources and close connections after tests.
Explore core assert methods in JUnit 5, including true/false and equals, and learn how assertions compare actual and expected values in unit tests.
Create separate test methods for each assertion type, validating equals, not equals, and true/false. Run tests to see green passes and ensure methods do not return values.
Master assertion testing and exception handling in java by validating null results and testing division by zero. Use executable and lambda expressions to verify expected exceptions like null pointer exceptions.
Master how to write assertions for arrays, strings, and collections in JUnit 5, using value-based equals and deep element checks across lists and sets to verify results.
Learn to use JUnit 5 lifecycle annotations such as before each, after each, before all, and after all to prepare and clean up test environments and manage resources.
Use the @DisplayName annotation in JUnit 5 to assign descriptive names to test methods and scenarios, so test display shows text like 'successful addition' instead of the method name.
Master the art of enabling and disabling tests in junit 5 by using environment variables, operating system checks, and Java version conditions.
Master JUnit 5 by ordering test methods with a class-level ordering annotation and per-method order values, ensuring tests run in a specified sequence while remaining self-contained.
Explore repeated tests in JUnit 5 with @RepeatedTest and repetition info. Measure memory and CPU load across repetitions using lists and streams.
Explore parameterized tests in java with junit jupiter, using value sources and csv data to run multiple inputs, verify calculations like square, and use custom test names.
Group related test cases using @Nested inner test classes with a clear display name, enabling single-unit execution and easier analysis of calculator addition functionality test suites.
Group tests by functionality with a JUnit 5 suite to run selected packages or classes, configuring inclusion and access as needed.
Publish test results from Maven using the Surefire and Maven Site plugins to generate a readable project report via the Maven Site, short report plugin, and Maven Jake Pretty.
You have reached the end of the course and understand the power of testing in Java development. A well-tested application runs longer and more reliably.
This course is for Java developers who are trying to learn JUnit5 to test their code.
JUnit is probably the most widely used unit testing framework for Java developers. It is the next iteration of JUnit after Junit4 and has a number of new features added.
Knowing how to test your code automatically and enabling your code to be seamlessly tested as part of a CICD pipeline is a "must have" for any developer.
With this course you learn:
JUnit 5 architecture - You learn the basic architecture of JUnit5 and how it builds on top of the JUnit testing platform.
Lifecycle annotations - @Test, @BeforeEach, @AfterEach, @AfterAll @BeforeAll
Testing using assertions - You learn to test for equality, null, exceptions etc...
Various testing scenarios - Write test cases using @RepeatedTest, @ParameterizedTest, @ConditionalTest
Grouping tests - group various tests using @Nested and @Suite annotations.
Reporting test results using maven. With just a few additions to your maven configuration, you will be able to publish these results to a web-page and also share it with your team.
All of the coding will be done on Eclipse. However, if you are familiar with IntelliJ, that should be fine too.
The course will be completely hands on, except when it is required to explain concepts.