If you want to learn how to work smarter, you have come to the right place. This is a beginner friendly course that teaches you techniques which help you to save time when you have to write tests with JUnit 5.
Why JUnit 5?
JUnit 5 is a very popular testing framework that’s used to write tests for JVM applications. If you have to write tests in 2023, it’s extremely likely that you must use JUnit 5. JUnit 5 has some great features which makes writing useful tests easier than it used to be. These features are:
- Compile and run JUnit 5 tests with Maven and Gradle.
- Filter the invoked test cases by using JUnit 5 tags.
- Describe the purpose of each test class, nested test class, and test method.
- Generate tests reports which identify the requirements of the system under test.
- Write basic assertions with JUnit 5 assertion API.
- Use your favorite assertion library.
- Remove duplicate code from your test suite.
- Save time by writing less test code.
- Remove duplicate code with parameterized tests.
- Mix parameterized tests with normal tests and get the best of both worlds.
- Integrate JUnit 5 with commonly used testing libraries and frameworks.
- Extend JUnit 5 and write the features you need.
Why Should You Learn From Me?
My name is Petri Kainulainen and I have used JUnit 5 from day one. In fact, I was one of the supporters of the JUnit Lambda crowdfunding campaign which funded the development of the first JUnit 5 version.
I have used JUnit 5 for writing tests to Java and Kotlin applications, and I have integrated it with testing libraries and frameworks such as AssertJ, Mockito, Mockk, Spring MVC Test, TestContainers, and WireMock. I have written thousands of tests with JUnit 5 and I am constantly looking for new ways to write better tests.
To be honest, I have to admit that I have written my share of bad tests. I created this course because I don’t want that you will make the same mistakes as I did.
If you bought my Test With Spring course, I will give you free access to this course. If you want to redeem this benefit, take a look at the FAQ.
If you aren’t living in the European Union, I cannot sell this course to you. I simply don’t have the time or money to ensure that I am not breaking any tax laws, which, by the way, are literally changing all the time. If you want to buy this course and you aren’t living in the European Union, drop me an email. If I get enough emails, I will check if there is something I can do to fix this problem.
Introduction to JUnit 5 Course
The Introduction to JUnit 5 course is a text-based course that has 25 lessons, 47 exercises, and 13 quizzes. This is an opinionated course and I will cover only the features which I have found useful when I have written unit and integration tests with JUnit 5.
The teaching method which I use in this course has three cornerstones:
- Every lesson of this course has practical learning goals and the lesson describes how you can achieve these goals. For example, a lesson might describe how you can create a Maven project that can compile and run tests which use JUnit 5.
- I believe that the easiest way to learn new things is to do them yourself. That’s why most lessons of this course have hands-on exercises. These exercises will help you to understand how you can use your new skills in your daily work.
- The quizzes of this course make sure that you have learned the required skills.
Here Is What You Get
This course is divided into six topics:
This topic describes how you can integrate JUnit 5 with Maven and Gradle. After you have finished this topic, you:
- Can get the required dependencies with Maven and Gradle.
- Know how you can run JUnit 5 tests with Maven and Gradle.
This topic helps you to write your first tests with JUnit 5. After you have finished this topic, you:
- Know how you can write normal and nested tests with JUnit 5.
- Can identify the invocation order of setup, teardown, and test methods.
- Understand how you can write parameterized tests with JUnit 5.
This topic describes how you can group your test methods and run only the tests which belong to a specific group. After you have finished this topic, you:
- Know how JUnit 5 tags work.
- Can add JUnit 5 tags to your test methods.
- Understand how you can select the invoked test methods with Maven and Gradle.
This topic describes how you can write assertions with JUnit 5 and use third party assertion libraries. After you have finished this topic, you:
- Can write assertions with JUnit 5 Assertion API, Hamcrest, and AssertJ.
- Understand how you can combine Hamcrest matchers.
- Know how you can shorten your feedback loop by using JUnit 5 assertion groups or writing soft assertions with AssertJ.
- Can emphasize business rules by writing custom Hamcrest matchers or writing custom assertions with AssertJ.
This topic describes how you can leverage the JUnit 5 extension model when you are writing tests with JUnit 5. After you have finished this topic, you:
- Know what JUnit 5 extension is.
- Can use JUnit 5 extensions.
- Understand how you can write your own JUnit 5 extensions.
This topic is under work! It’s missing lessons, quizzes, and exercises.
This topic identifies best practices which help you to write better tests with JUnit 5. After you have finished this topic, you:
- Understand what kind of test cases you should write.
- Know how you can select the test cases which have the best ROI if you don’t have enough time to test all possible scenarios.
- Understand why you should write your assertions with AssertJ.
- Know how you can save your time by writing nested tests which don’t have duplicate code.
- Understand how you can remove duplicate code from your test suite by writing parameterized tests.
Take a Look at the Material Before You Buy
I don’t expect anyone to buy this course if they cannot take a look at the material before the purchase. That’s why I have published these sample lessons:
- Introduction to JUnit 5 Tags
- Filtering Tests With Maven and Gradle
- Introduction to JUnit 5 Extensions
14-Day Unconditional Money Back Guarantee
I have put a lot of work into this course and I am confident that it will be useful to you. That’s why I am offering a 14-day unconditional money back guarantee. If this course doesn’t help you save your time, just contact support within 14 days of your purchase and you will get your money back. No questions asked.
Get Started Today
Let’s assume that one hour of your time is worth 100 euros. If this course helps you to save half an hour, your investment has been worth it. In other words, if you value your time, getting this course is a no-brainer.
You can get started by clicking the following button. After you have finished the checkout process, you will get instant access to the Introduction to JUnit 5 course and you are good to go.