
JUnit Tutorial (Unit Testing in Java) - JUnit 5 Framework
OtherPrice
This course is free to enrol.
Enrol free on the course site →Mark your own learning status. Opening a course link does not establish enrollment.
Loading saved status…
This Test Automation University course covers the features of JUnit 5 in order, using Java and IntelliJ. It starts with project setup and basic tests, then works through lifecycle methods, parameterized tests and test ordering across 18 chapters.
Java testers who want a structured, feature-by-feature tour of JUnit 5 will find the chapter order straightforward. The description points to an earlier IntelliJ tutorial if you are new to the IDE.
Hello there. I'm Corina, and I am back to Test Automation University with a brand new tutorial - this time on JUnit 5.
This is going to be a very interesting journey as we're going to go through all of the features of this framework, and I really hope this is going to be something that will help you to use JUnit 5 in your testing from now on.
Now this is quite an interesting library - it has a lot of great features for our testing, and we will go through all of them chapter by chapter.
We will start with a little bit of setup in order to create a project to write our tests and to enable the use of JUnit 5 in the project.
We will then start with writing a few very basic tests and then we will introduce the so-called lifecycle methods, the befores and afters of this framework.
We will then have a few chapters where we will see how to run the same code from a test method, but with different values that will be passed to the method by means of parameter values.
We will see how in JUnit 5, we can use different ways of providing the values for those parameters.
Then we will take a look at how to run our tests in the order in which we want them to run.
We will take a look at assumptions, which are an interesting feature of this framework - namely, having code run only when certain conditions are met.
After, we will take a look at how to enable and disable tests based on certain conditions.
In chapter 11, we will take a look at how to repeat tests, meaning how to run the exact same test several times.
Then in the next chapter, we will see how we can add tags to our tests, which will allow us to select them based on their tags in order to run them for certain, either CI jobs or for the testing of certain features.
We will introduce assertions in chapters 13 and 14 and we will start with the JUnit 5 specific assertions.
After, we will take a look at how to use assertions from an external library - in the case of this tutorial, we will look at Hamcrest.
We will then go a bit more in depth into how to run the tests.
In chapter 16, we will see how to grab some information from the test run in order to generate our useful testing reports.
In chapter 17, we will briefly look over a few aspects, namely timeouts for tests, or nested tests, which means inner tests for our test classes, and also how to create our own composed annotations.
In chapter 18, we will see how we can migrate from JUnit 4, in case we are using that version of the library in our project.
Just before I start, a few things to mention.
This tutorial will use Java as a programming language and IntelliJ as the editor for the code, as you've probably already guessed because of my previous tutorial on IntelliJ.
If you haven't taken that tutorial yet, please do so.
Advertisement
No Korshub reviews yet.