Specifically the chapter no. 20 (“Listening to the tests”) from Growing Object-Oriented Software Guided by Tests available here is so good to learn to hear to your tests.
To hear what they’re trying to tell you, the authors (Steve Freeman and Nat Pryce) explain this to you:
- I Need to Mock an Object I Can’t Replace
- Logging Is a Feature
- Mocking Concrete Classes
- Don’t Mock Values
- Bloated Constructor
- Confused Object
- Too Many Dependencies
- Too Many Expectations
To close, a quote:
[…] We’ve found that the qualities that make an object easy to test also make our code responsive to change
Growing Object-Oriented Software Guided by Tests, chapter 20, page 229