Introduction: Writing Our First Test

Get an introduction to what you’ll learn in this chapter.

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 chapter. To do this, we’ll learn about a simple template that helps us organize each test into a logical, readable piece of code. Along the way, we’ll learn some key principles we can use to make our tests effective. We’ll 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.

Chapter goals

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

In this chapter, we’ll cover the following main principles behind writing effective unit tests:

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy