
In this introduction lecture we will talk about topics which are covered in this course. Presentation is also available for download in the resource section
In this lecture we will discuss why unit testing is so important and we should create a test class for each and every class in our application. Presentation is also available for download in the resource section
In this lecture we will define our first unit test using JUnit5 framework for a simple Java class
In this lecture we create a new mock Java class Car, define class variables and methods. In the next lectures we will use this class to explore in more details the capabilities of JUnit framework
In this lecture you will learn how to use methods defined in JUnit5 to assert expected vs actual result:
assertEquals(primitive, primitive)
assertEquals(Object, Object)
assertArrayEquals(Object[], Object[])
assertTrue(boolean expression)
assertFalse(boolean expression)
In this lecture you will learn some commonly used annotations in JUnit and when to use each of them:
@Test
@Disabled
@DisplayName
@BeforeEach
In this lecture we will create a test class and define unit tests for each method of our class Car
In this lecture you will learn what are some common reasons why unit tests could fail and what do to fix them
In this lecture you will learn how to find out how many methods / code of your classes are covered with unit tests
In this course you will be guided through the basics of Java unit testing using JUnit5 framework. You do not need to have any prior JUnit experience or knowledge to take this course. All you need to have - willingness to learn some new exiting things about unit testing on Java using JUnit5 framework and some time to write unit tests along with me.
Some basic Java knowledge is required, you need to be familiar with some basic concepts like class, method, variables, objects, etc.
Java 11 LTS is used in this course and examples are shown in IntelliJ IDEA. But all taught content will work fine on later versions of Java.
We will define a basic Java class and for each method of this class we will create unit tests, so we could be sure everything works as it should.
The most important topics covered in this course includes
Explanation why we should include unit tests in each our application
How to define a test class, where all unit tests will reside
Important annotations used in test classes
How to interpret unit tests results
How to fix failed tests
I hope you will really enjoy opening for yourself a new entertaining world of unit testing on Java!