
Hi Dennis, I completely agree with Niall... I participated in the development of a systems, in VASmalltalk & GemStone, that has 23.000 tests that run in 7 minutes and we hardly needed to use mocks... we mostly needed to have polymorphic objets with the real ones and sometimes we used the same test to do it and sometimes we just used the real ones that were created using resources... I prefer to use real objects instead of mocks or test doubles because when using test doubles (which includes mocks) you are not testing the real thing, so for example, I do not use test doubles for objects that are part of the system I'm writing but only for objects outside the system. My experience of teaching/coaching TDD shows that test doubles are more important due to its difficulty of using, in statically typed languages, which makes sense because the coupling between the "client" object and the "server" object is the variable's type instead of only the messages that are sent. I also believe that TDD is popular in Smalltalk... why do you think it is not? Bye! Hernan. On Fri, May 27, 2011 at 10:16 AM, Niall Ross <nfr@bigwig.net> wrote:
Dear Dennis,
I'd like to explore interest to Mock Object in Smalltalk society. I'm currently working on the topic, preparing a paper and presentation targeting at ESUG 2011.
Sounds interesting.
Steve Freeman (via Joseph Pelrine) wrote:
You should talk to Tim, he wrote a mocks library in about 3 classes (which
is what it should take). He also has some interesting experience from the Kapital project that doesn't have unit tests.
Tim Mackinnon mentions mock objects in his talk 'Expressive Testing and Code for Free' at ESUG 2007 (report reachable from http://www.esug.org/Conferences).
You remark
Apparently, Mocks technique is not popular tool among Smalltalkers.
and Steve, noting that, says
I hadn't realised that the ST world was behind in this respect.
I note that one or two who replied to your earlier post said they had not needed Mocks, or found them brittle, but I don't think the technique is _unpopular_ in Smalltalk. My own take is
1) Smalltalk's power means mocks are not needed as often. Many a time, you can get at what you need directly, or by use method wrappers to make the real objects (or the routes to them) act momentarily as mocks.
Here, I may be saying the same as you:
Yes, Smalltalk is great language and it has great tools.
This damps some aspects of the problems TDD and Mocks address, but for sure does not remove them totally.
2) Another dynamic language feature is that you can more easily structure tests so the same test can be run against both the mock and the real object when the latter is available. (The approach is the same as in my talk "eXtreme UI Testing" at Smalltalk Solutions 2007, also reachable from the http://www.esug.org/Conferences page.)
These features may sometimes make people less thorough in setting up a full mocks framework for their application's tests.
It even seems (to me), TDD is not as widely used as it could and should
be (despite the fact it was born in Smalltalk).
I don't think TDD is in the least unpopular or unrespected in Smalltalk. However I'm sure you are right when you say it "is not as widely used as it could and should be", though I'd be surprised if that were more true of Smalltalk than of other languages.
I have been using TDD and
Mocks for many years in different projects with Smalltalk and other languages. Sometimes it was hard, sometimes I was even giving it up, but by now I think I have sufficient experience to state that TDD in general and Mock Objects specifically do deserve (at least) more attention by Smalltalkers. ... I was most productive in Smalltalk when I used
"classic TDD" and mocks in conjunction.
If your talk uses your experience to illuminate why what we "could and should be" doing was "sometimes ... hard ... even giving it up", but "most productive", that might be very useful to others.
Yours faithfully Niall Ross
______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email____________________________________________...
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org
-- *Hernán Wilkinson Agile Software Development, Teaching & Coaching Mobile: +54 - 911 - 4470 - 7207 email: hernan.wilkinson@10Pines.com site: http://www.10Pines.com <http://www.10pines.com/>*