If people actually read “XUnit Test Patterns: Refactoring Test Code” by G. Meszaros maybe they’d understand what test doubles are, or when/why to use them. Maybe they wouldn’t write how they hate “mocks”, but focused on merits of their approach.

There’s so much misunderstanding and non-constructive criticism in our profession. I really admire those few people I know who strive to write from a positive angle. I’m not sure if I’d be able to doit.

#testing #mocks #notrealymocks #testdoubles #tdd

@jakub_zalas In my experience it's the tooling around creating spies/mocks that cause most of the pain. Makes it easy to not have to understand what they actually need.

I spend many hours in my courses explaining and covering the different types. But it's hard to unlearn those bad habits from tools like Mockito.

@jitterted I had some success by teaching hand-crafted test doubles before introducing a library. Those teams usually had little experience writing any tests though.
@jakub_zalas I gave a talk on 'mocking considered harmful' at CPPCon and am owner and early reader of Gerard's work. However, as with all patterns there are benefits and liabilities. and unfortunately many mocking framework users are unaware of the liabilities...
but when you have the problem that mocking solves and can live with its liabilities , then it is OK to use mocking consciously.