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

Use Available Facilities

This is frequently expressed as “test through the interface.” In the general sense, the statements are equivalent, but object-oriented programming languages have also given us a narrower interpretation that is not sufficient. This principle is broader than simply using the methods declared in an interface.

When writing tests, we want to minimize the degree to which we change the code under test to accommodate testability. The best way to do that is to use the features that already exist. This may be obvious for constructors, setters, and getters and completely natural and necessary for method arguments, return values, and other direct functionality. I have often seen other features of the code overlooked as potential ...

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