TDD
TDD stands for test-driven development. It is a process in which you write tests for business requirements before your software is fully developed. As you write code, you repeatedly update your test cases until you are satisfied the code satisfies the business requirements. The goal is to write “just enough” code to pass the tests and no more. A diagram representing this process is shown here:
Figure 8.1 – TDD flow chart
Let’s look at each of the steps in isolation. If we were developing a new feature for our application, we would do the following:
- Add a test: Before we write any code, we write the test case. You might write this in the form of a user story such as “As an API user, I want to be able to see a user’s balance across all their accounts when I call the /balances endpoint so that I can display it on the home screen,” or by using the Given-When-Then method: “Given I am an API user...