Session: Budgeting Reality: a New Approach to Mock Objects

Wednesday 11.10 - 12.00
Room: Grinding the Crack

Some say "mocks suck," because they reduce a test's realism and with it the confidence that the code being tested actually works. Others use mocks to demarcate the outer boundary of an application, guarding the test from expensive or external dependencies (e.g. by faking a database or network resource). Still others see mocks as a "setup of last resort", using them only to mitigate the pain of hard-to-test code. Finally, some developers mock out every collaborator in every test, and their rationale is probably the least understood of them all!

This talk will serve as an opinionated (if broad-stroke) survey of the different ways people use test doubles (be they mocks, fakes, stubs, or spies). Our goal will be to establish a more sophisticated means of communicating on the topic. We'll discuss the pros & cons of the different approaches toward mocking, the smells of test double abuse, and the lessons I took away from writing my own test double library.

Tags: Mastery

Justin SearlsJustin Searls

Justin Searls has two professional passions: writing great software and sharing what he’s learned in order to help others write even greater software. He recently co-founded a new software studio called Test Double, where he’s currently helping clients build well-crafted user experiences for the web.