Implementations

Almost by definition, you will not be able to test all of an implementation through its interface. All but the simplest of implementations will require nontrivial code to bring the interface’s behavior to life. In other instances, an interface only represents a single role of an implementation class. Sometimes a class will implement multiple interfaces in this way.

You are less likely to encounter this phenomenon in functional or procedural languages in which the code under test has a single purpose. However, if you take a feature-based, rather than function- or method-based, approach to your testing, you may find the need to invoke multiple functions to test the feature, not all of which are part of a published interface.

Using ...

Get Quality Code: Software Testing Principles, Practices, and Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.