[TIP] Mock objects in testing object composition?

Michael Foord fuzzyman at voidspace.org.uk
Fri May 18 10:55:35 PDT 2007


Jim Fulton wrote:
> On May 17, 2007, at 11:11 AM, Benji York wrote:
>
>   
>> Kumar McMillan wrote:
>>     
>>> On 4/24/07, Julius Lucks <lucks at fas.harvard.edu> wrote:
>>>       
>>>> Many thanks Benji and Paul.
>>>>
>>>> Looks like simpler is better.  So when are mock objects useful?
>>>>         
>>> in my experience, mock objects are useful mostly for depending on  
>>> some
>>> kind of "external" resource.
>>>       
>> Purists would probably call those "stubs" instead of "mocks", but I  
>> see
>> what you're saying.
>>     
>
> Since this is a testing list, I think it would be helpful to be  
> careful about jargon so as not to sow confusion.  I think we should  
> distinguish between stubs and mocks, providing the link to:
>
>    http://www.martinfowler.com/articles/mocksArentStubs.html
>
> when there is confusion, assuming of course, that Fowler is correct  
> in his characterization. :)
>   

I dislike the distinction he draws. Where you are creating simple 
objects that pretend to be other classes for the purposes of testing, by 
normal usage of English you *are* creating mock objects.

I think he has hijacked the term for something which is actually far 
less common...

Michael Foord
http://www.voidspace.org.uk/ironpython/index.shtml

> Jim
>
> --
> Jim Fulton			mailto:jim at zope.com		Python Powered!
> CTO 				(540) 361-1714			http://www.python.org
> Zope Corporation	http://www.zope.com		http://www.zope.org
>
>
>
>
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python
>
>
>   




More information about the testing-in-python mailing list