Chapter 2. Writing Well-structured Tests
In this chapter, we're going to learn how to write unit tests with a clean and consistent structure by means of the four-phase pattern, and outline why it is important to do so. We'll be explaining the purpose of a fixture, and how to get a clear definition of the relation between a component's behavior and its verification. Furthermore, we're going to gain insight on what to test, where to start, how to continue, and how to know when we are done. We'll be concluding with a discussion on the pros and cons of various testing naming conventions. In a nutshell, we will be going through the following topics:
- The four phases of a unit test
- Choosing the next functionality to test
- Getting the test names right
The ...
Get Testing with JUnit now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.