Re: Single assert / Single mock rule in practice

Mateusz Łoskot <[email protected]> Fri, 17 Jan 2014 09:40:51 +0000
Newsgroups gmane.comp.programming.test-driven-development
Message-ID <CABUeae-RA9rUhM1WPPhb4XB37-r083AGhAzQAZUWSX=Wf2ozMg@mail.gmail.com>
On 15 January 2014 20:20, Adam Sroka <[email protected]> wrote:

>
> Are you familiar with Command Query Separation (CQS)?
>

Sort of, related to Tell, Don't Ask?
I'll learn about it, thanks.

I've always found that the most coherent and useful way to explain why you
> would choose a mock or a stub. The most interesting thing about a method is
> either what it returns or, in the case where you don't care what it
> returns, whether it was called with the correct semantics, not both.
>
So, if the SUT cares about the value that a method returns then you stub
> that method, only. If the SUT doesn't care about the value a method returns
> then you use a mock and verify the call has the expected semantics, only.
>


That is something!
That actually answers my original question on what approach to choose
and how 'widely' to mock or stub things.


Does that help?
>

Yes, it is very helpful, thanks!,_._,___

Best regards,
-- 
Mateusz  Łoskot, http://mateusz.loskot.net