Summary (TL;DR)
Mock objects are often confused with stubs, but they differ in two ways: state verification vs behavior verification, and classical vs mockist TDD. State verification checks the state of the SUT and collaborators after exercise, while behavior verification checks if the correct calls were made on mocks. Classical TDD uses real objects when possible, mockist TDD always uses mocks for interesting collaborators. Mockist testing supports need-driven development and promotes role interfaces and Tell Don't Ask, but couples tests to implementation. Classical TDD requires more fixture setup but avoids that coupling. The choice depends on whether you value test isolation and design guidance (mockist) or looser coupling and focus on external behavior (classical).
Public access expired
Save this link to your readplace queue to see the full content.
Save to My Queue