¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: [TDD] Single assert / Single mock rule in practice


Mateusz ?oskot
 

On 15 January 2014 20:20, Adam Sroka <adam.sroka@...> 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,

Join [email protected] to automatically receive all group messages.