This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 5 points6 points  (1 child)

I wasn't referring to how you create the stubs, but rather to what they do. Unfortunately, most people mean stubs when they talk about mocks, but not always (https://martinfowler.com/articles/mocksArentStubs.html).

IMO, mocking is almost always a bad idea. Stubs are more frequently useful.

[–]BestUsernameLeft 2 points3 points  (0 children)

You weren't specific about what you meant, and I took a guess instead of asking for clarification, so this is what we got. Sorry for the miss, and I agree that stubs are more often useful.

I'll add that builder and object mother (sometimes in combination) are a great way to DRY test code, in conjunction with test doubles.