Cover
Title Page
Copyright Page
第 iv 页
Contents
Foreword by Jeff Langr
Foreword by Lisa Crispin
Preface
Acknowledgments
About the Author
Chapter 1 Developer Testing
Developers Test
Developer Testing Activities
What Developers Usually Don’t Do
Defining Developer Testing
Developer Testing and the Development Process
Summary
Chapter 2 Testing Objectives, Styles, and Roles
Testing and Checking
Testing Objectives
Testing Styles
Your Quality Assurance and Developer Testing
Summary
Chapter 3 The Testing Vocabulary
Errors, Defects, Failures
White Box and Black Box Testing
Classifying Tests
The Agile Testing Quadrants
Some Other Types of Testing
Summary
Chapter 4 Testability from a Developer’s Perspective
Testable Software
Benefits of Testability
Testability Defined
Summary
Chapter 5 Programming by Contract
Contracts Formalize Constraints
Implementing Programming by Contract
Enforcing Contracts
Summary
Chapter 6 Drivers of Testability
Direct Input and Output
Indirect Input and Output
State
Temporal Coupling
Data Types and Testability
Domain-to-Range Ratio
Summary
Chapter 7 Unit Testing
Why Do It?
What Is a Unit Test?
The Life Cycle of a Unit Testing Framework
Naming Tests
Structuring Tests
Assertion Methods
Testing Exceptions
Behavior-driven Development–Style Frameworks
Summary
Chapter 8 Specification-based Testing Techniques
Equivalence Partitioning
Boundary Value Analysis
Edge Cases and Gotchas for Some Data Types
State Transition Testing
Decision Tables
Summary
Chapter 9 Dependencies
Relations between Objects
System Resource Dependencies
Dependencies between Layers
Dependencies across Tiers
Summary
Chapter 10 Data-driven and Combinatorial Testing
Parameterized Tests
Theories
Generative Testing
Combinatorial Testing
Summary
Chapter 11 Almost Unit Tests
Examples
Impact
Summary
Chapter 12 Test Doubles
Stubs
Fakes
Mock Objects
Spies
Dummies
Verify State or Behavior?
Summary
Chapter 13 Mocking Frameworks
Constructing Test Doubles
Setting Expectations
Verifying Interactions
Misuse, Overuse, and Other Pitfalls
Summary
Chapter 14 Test-driven Development—Classic Style
Test-driving a Simple Search Engine
Order of Tests
Red- to Green-bar Strategies
Challenges
Test First or Test Last?
Summary
Chapter 15 Test-driven Development—Mockist Style
A Different Approach
Double-loop TDD
Summary
Chapter 16 Duplication
Why Duplication Is Bad
Taking Advantage of Duplication
Mechanical Duplication
Knowledge Duplication
Summary
Chapter 17 Working with Test Code
Commenting Tests
Deleting Tests
Summary
Chapter 18 Beyond Unit Testing
Tests that Aren’t Unit Tests
Characteristics of Tests that Aren’t Unit Tests
Pointers and Practices
Deciding on a Developer Testing Strategy
Summary
Chapter 19 Test Ideas and Heuristics
High-level Considerations
Low-level Considerations
Summary
Appendix A: Tools and Libraries
Appendix B: Source Code
Test Doubles
Data-driven and Combinatorial Testing
Test-driven Development
Beyond Unit Testing
Bibliography
Index
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Z