Introduction and Prerequisites
Get an introduction to test-driven development and explore the course’s prerequisites and intended audience.
We'll cover the following
Test-driven development (TDD)
Modern software is driven by users wanting new features, with no defects, released rapidly—a very challenging task. Solo developers have given way to development teams working together on a single software product. Features are added in short iterative cycles, then released to production frequently—sometimes daily. Achieving this requires excellence in development. We must ensure that our software is always ready to be deployed and free of defects when it is released into production. It must be easy for our developer colleagues to work with. Code must be easy for anyone to understand and change. When the team makes those changes, we must have confidence that our new features work properly and that we have not broken any existing features. This course brings together proven techniques that help make this a reality.
Test-driven development (TDD), the SOLID principles, and hexagonal architecture enable developers to engineer code that is known to work and known to be easy to work with. Development focuses on the fundamentals of software engineering. These practices are the technical foundation behind a code base that is easy and safe to change and always ready to be deployed.
Course objectives
This course will enable you to write well-engineered, well-tested code. You’ll have confidence that your code works as you think it should. You’ll have the safety of an ever-growing suite of fast-running tests, keeping a watchful eye over the whole code base as the team makes changes. You’ll learn how to organize your code to avoid difficulties caused by external systems such as payment services or database engines. You’ll reduce your dependence on slower forms of testing. You’ll be writing higher quality code, suitable for a continuous delivery approach. Modern software requires a modern development approach. By the end of this course, you’ll have mastered the techniques to apply one.
Prerequisites and target audience
This course is primarily aimed at developers who are familiar with the Java language basics, and who want to be effective in a high-performance agile development team.
The techniques described in this course enable your code to be delivered to production with fewer defects, and a structure that can be easily and safely changed. This is the technical basis of agility. The course’s early chapters will also be useful to business leaders who want to understand the costs and benefits of these approaches before committing to them. This course assumes you know basic modern Java and can write short programs using classes, JDK 8 lambda expressions, and can use the JDK 11 var
keyword. Basic knowledge of SQL, HTTP, and REST will be helpful in the final chapters. This course is primarily aimed at developers who are familiar with the Java language basics, and who want to be effective in a high-performance agile development team.
Course outline
This course consists of 15 chapters, 150 lessons, and 6 challenges. It’s divided into three parts:
Part 1: Journey to TDD
Part 2: TDD Techniques
Part 3: Real-World TDD
Let’s take a look at the chapter division in each part.
Part 1: Journey to TDD
In Part 1, we look at how we got to TDD in the software industry. What problems are we trying to fix with TDD, and what opportunities does it create? In these chapters, we’ll learn about the benefits that TDD brings to businesses and developers. We’ll review the basics of good code to provide something to aim for when we first start writing our tests. Knowing that teams are sometimes hesitant to start using TDD, we’ll examine six common objectives and how to overcome them.
Part 2: TDD techniques
Part 2 introduces the techniques necessary for effective TDD. Along the way, we’ll incrementally build the core logic of a word guessing game, Wordz–writing all our tests first. By the end of this part, we’ll have produced high-quality code by writing tests first. The SOLID principles and hexagonal architecture will help us organize code into well-engineered building blocks that are easy to test. Test doubles will bring external dependencies under our control. We’ll look at the bigger picture of test automation and how the test pyramid, QA engineers, and workflow improve our work.
Part 3: Real-world TDD
Part 3 is where we’ll apply all the techniques we’ve learned to complete our application. Wordz is a web service that plays a word guessing game. We’ll build on the core domain logic we’ve already built, adding storage via a Postgres database accessed using SQL and providing web access by implementing an HTTP REST API. We’ll use integration tests to test-drive our database and API implementations, making use of test frameworks that simplify these tasks. In the final chapter of the course, we’ll bring everything together to confidently run our test-driven Wordz application.