[Esug-list] Proposal for Mock Objects at ESUG 2011
goran at krampe.se
Tue May 31 17:21:04 EDT 2011
On 05/31/2011 04:59 PM, Frank Shearar wrote:
> 2011/5/31 Göran Krampe<goran at krampe.se>:
>> So refreshingly to see someone that *also* notes that testing using mocks
>> actually break encapsulation. Thank you, thank you...
> Or to rephrase, "documenting the precise nature of the colloboration
> between an object and its context documents that precise nature."
> In Colin's example, Set's collaboration with Array is purely an
> implementation detail and, as he notes, testing the implementation -
> whether checking that Set stores the value in the array, or what
> messages Set might send to Array - hurts you.
> I fail to see how that makes mocks bad. Unless you're railing against
> hype? In which case, I agree: there ain't no such thing as a free
> lunch, there is no silver bullet, etc etc.
Well, yes, railing against hype. But also railing against writing tests
that work from "the inside" by using mocks. It is of course a matter of
taste, style and in the end weighing pros and cons. But I have seen too
much use of mocks that end up making the tests purely mirror the
implementation - so even the slightest internal modification would break
More information about the Esug-list