7.1. What’s testable design?

The fundamental value proposition of testable design is being better able to test code. Quoting Roy Osherove, the author of The Art of Unit Testing with Examples in .NET (Manning Publications, 2009), “a given piece of code should be easy and quick to write a unit test against.” More specifically, testable design makes it easy to instantiate classes, substitute implementations, simulate different scenarios, and invoke particular execution paths from our test code.

Testability isn’t an absolute yes-or-no property of a design. As Scott Bellware put it, “Testability is not a term that describes whether software can be tested. It refers to software that is easily tested.”[1] It should be a breeze for a programmer to set ...

Get Effective Unit Testing now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.