O'Reilly logo

Quality Code: Software Testing Principles, Practices, and Patterns by Stephen Vance

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

On Toothpaste and Testing

I often call the approach of bottom-up testing toothpaste testing. You start from the bottom and slowly squeeze your way to the top. It goes hand in hand with toothpaste refactoring, which follows the same pattern and is supported by toothpaste testing.

Toothpaste refactoring provides an alternative to the legacy rescue approach of using characterization tests to drive down from the top. Both have their places. I have seen many occasions in which seemingly beneficial refactorings—such as adding dependency injection or changing signatures—percolate down through the call hierarchy only to be stopped by some strange construct. Additionally, top-down refactoring runs the risk of going long periods of time without your testing ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required