Re: Single assert / Single mock rule in practice
Mateusz Łoskot <[email protected]> Wed, 22 Jan 2014 13:47:04 +0000
| Newsgroups | gmane.comp.programming.test-driven-development |
|---|---|
| Message-ID | <CABUeae-uN+p5Ge+ZHgsUqKOtv0CxkDJj6EGb3477k01b5_ezrg@mail.gmail.com> |
On 16 January 2014 10:33, Roy Osherove <[email protected]> wrote: > For example, I would use a STUB for a get_something if not faking it meant > an integration test. > I would not use a mock for it, since it is giving info back into the > application. > I would use a mock only if there an is a "tell" operation on a > collaborator as an end result. > stubs: queries > mocks: commands > but only when you have no other choice but to fake it. I would rather test > state or a return value and have only real classes. Mocks make tests > complicated. > Roy, Thanks for the excellent clarification, it helps to grasp other resources of yours that I've had pleasure to read/watch. Best regards, -- Mateusz Łoskot, http://mateusz.loskot.net