Home Page Icon
Home Page
Table of Contents for
Chapter Map
Close
Chapter Map
by Vladimir Khorikov
Unit Testing Principles, Practices, and Patterns
Copyright
Brief Table of Contents
Table of Contents
Preface
Acknowledgments
About this book
About the author
About the cover illustration
Part 1. The bigger picture
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
Summary
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
Summary
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
Summary
Part 2. Making your tests work for you
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
Summary
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
Summary
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
Summary
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
Summary
Part 3. Integration testing
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
Summary
Chapter 9. Mocking best practices
9.1. Maximizing mocks’ value
9.2. Mocking best practices
Summary
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
Summary
Part 4. Unit testing anti-patterns
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
Summary
Chapter Map
Index
List of Figures
List of Tables
List of Listings
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
Chapter 11. Unit testing anti-patterns
Next
Next Chapter
Index
Chapter Map
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset