May 2017
Intermediate to advanced
370 pages
8h 6m
English
Testing how the code-under-test deals with collaborators by using mock and stub test doubles is called interaction testing. This is one of the most misunderstood and abused techniques in automated testing. Inappropriate use of mocks and stubs can tightly couple your test code to the implementation details, causing brittle tests and making refactoring difficult because changes in how a unit works can break tests, even though the behavior is still correct. At the same time, mocks and stubs can enable a modular design that uses Inversion of Control (IoC) to define the relationships between units resulting in loosely coupled code that cooperates through well-defined interfaces.
Read now
Unlock full access