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 the implementation and implementation-specific features directly is still a strong way to test your code. It provides direct verification of behaviors that are not accessible through published interfaces without incurring additional dependencies or fragile indirections.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.137.75