by gfodor · 14y ago · 0 comments
I do use test doubles, including mocks, where things become difficult or slow to test (generally application boundaries). But keep in mind that every line of mocking code costs more than an equivalent line of the alternative.
But the only thing I use mocking/stubbing for is to mock out external services that make tests unreliable and slow (like HTTP requests).
Expectation based tests seem particularly easy to mis-use. Who cares how many times a method is called?
How do you test failure handling code when the failure can not be reproduced in a known way by the current code base?
I agree these tools are often overused, however they do have their roles.