Introduction: Writing Our First Test

Get yourself introduced to what we will learn in this section.

We'll cover the following

Learn to write tests

It’s time for us to dive in and write our first TDD unit test in this section. To help us do this, we will learn about a simple template that helps us organize each test into a logical, readable piece of code. Along the way, we will learn some key principles we can use to make our tests effective. We will see how writing the test first forces us to make decisions about the design of our code and its ease of use, before needing to think about implementation details.

Section goals

After some examples covering those techniques, we will make a start on our Wordz application, writing a test first before adding production code to make that test pass. We will use the popular Java unit testing libraries JUnit5 and AssertJ to help us write easy-to-read tests.

In this section, we will cover the following main principles behind writing effective unit tests:

Get hands-on with 1200+ tech skills courses.