liveBook · Manning

What you will learn in Unit Testing Principles, Practices, and Patterns

by Vladimir Khorikov

Chapter by chapter

Chapter 1: Chapter 1. The goal of unit testing

1.1 The current state of unit testing · 1.2 The goal of unit testing · 1.3 Using coverage metrics to measure test suite quality · 1.4 What makes a successful test suite? · 1.5 What you will learn in this book · 1.6 Summary

What you learn in chapter 1 →

Chapter 2: Chapter 2. What is a unit test?

2.1 The definition of “unit test” · 2.2 The classical and London schools of unit testing · 2.3 Contrasting the classical and London schools of unit testing · 2.4 Integration tests in the two schools · 2.5 Summary

What you learn in chapter 2 →

Chapter 3: Chapter 3. The anatomy of a unit test

3.1 How to structure a unit test · 3.2 Exploring the xUnit testing framework · 3.3 Reusing test fixtures between tests · 3.4 Naming a unit test · 3.5 Refactoring to parameterized tests · 3.6 Using an assertion library to further improve test readability · 3.7 Summary

What you learn in chapter 3 →

Chapter 4: Chapter 4. The four pillars of a good unit test

4.1 Diving into the four pillars of a good unit test · 4.2 The intrinsic connection between the first two attributes · 4.3 The third and fourth pillars: Fast feedback and maintainability · 4.4 In search of an ideal test · 4.5 Exploring well-known test automation concepts · 4.6 Summary

What you learn in chapter 4 →

Chapter 5: Chapter 5. Mocks and test fragility

5.1 Differentiating mocks from stubs · 5.2 Observable behavior vs. implementation details · 5.3 The relationship between mocks and test fragility · 5.4 The classical vs. London schools of unit testing, revisited · 5.5 Summary

What you learn in chapter 5 →

Chapter 6: Chapter 6. Styles of unit testing

6.1 The three styles of unit testing · 6.2 Comparing the three styles of unit testing · 6.3 Understanding functional architecture · 6.4 Transitioning to functional architecture and output-based testing · 6.5 Understanding the drawbacks of functional architecture · 6.6 Summary

What you learn in chapter 6 →

Chapter 7: Chapter 7. Refactoring toward valuable unit tests

7.1 Identifying the code to refactor · 7.2 Refactoring toward valuable unit tests · 7.3 Analysis of optimal unit test coverage · 7.4 Handling conditional logic in controllers · 7.5 Conclusion · 7.6 Summary

What you learn in chapter 7 →

Chapter 8: Chapter 8. Why integration testing?

8.1 What is an integration test? · 8.2 Which out-of-process dependencies to test directly · 8.3 Integration testing: An example · 8.4 Using interfaces to abstract dependencies · 8.5 Integration testing best practices · 8.6 How to test logging functionality · 8.7 Conclusion · 8.8 Summary

What you learn in chapter 8 →

Chapter 9: Chapter 9. Mocking best practices

9.1 Maximizing mocks’ value · 9.2 Mocking best practices · 9.3 Summary

What you learn in chapter 9 →

Chapter 10: Chapter 10. Testing the database

10.1 Prerequisites for testing the database · 10.2 Database transaction management · 10.3 Test data life cycle · 10.4 Reusing code in test sections · 10.5 Common database testing questions · 10.6 Conclusion · 10.7 Summary

What you learn in chapter 10 →

Chapter 11: Chapter 11. Unit testing anti-patterns

11.1 Unit testing private methods · 11.2 Exposing private state · 11.3 Leaking domain knowledge to tests · 11.4 Code pollution · 11.5 Mocking concrete classes · 11.6 Working with time · 11.7 Conclusion · 11.8 Summary

What you learn in chapter 11 →

Concepts explained in this book

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.