I just watched this funny YouTube Video about unit testing (it's Hitler with fake subtitles chewing out his team for not doing good unit tests--skip it if you're humor impaired) where stubs get roundly criticized. But I don't understand what wrong with stubs.
I haven't started using a mocking framework and I haven't started feeling the pain from not using one.
Am I in for a world a hurt sometime down the line, having chosen handwritten stubs and fakes instead of mocks (like Rhinomock etc)? (using Fowler's taxonomy)
What are the considerations for picking between a mock and handwritten stub?
There is nothing wrong with stubs, there is room for stubs, mocks... and spies. All are "test doubles", but with different purposes as explained in Mocks and Stubs aren't Spies:
[...] Before moving on, I'd like to clarify and define some terms in use here, which I originally discovered in Gerard Meszaros' xUnit Patterns book.
- A Dummy Object is a placeholder object passed to the system under test but never used.
- A Test Stub provides the system under test with indirect input
- A Test Spy provides a way to verify that the system under test performed the correct indirect output
- A Mock Object provides the system under test with both indirect input and a way to verify indirect output
[...] And you can let this handy chart guide your decisions:
PS: Mockito - The New Mock Framework on the Block is worth the read too.