[Pharo-project] Fwd: [Pharo-users] TestMock: a full featured mock testing framework now available in SqueakSource

Dennis Schetinin chaetal at gmail.com
Wed Nov 24 04:31:26 CET 2010


As for me, I'm simply unable to establish smooth test-driven process without
Mocks. I think it does not depend on language at all.

Without mocks I have to divide the task I have into smaller independent
parts. It's actually an up-front design. I can make a mistake (I usually
do); even worse it's often just impossible to accomplish because too many
subcomponents usually interact thoroughly and I simply don't know which one
to implement first :). So, without mocks I have to code bottom-up, from
details to general. This is unnatural and error-prone.

With mocks I can start directly from the task I have. I get a use case and
write a test for the one. Creating the test I detect subcomponents needed,
understand how they should interact and document that in the same test. As
those subcomponents do not exist yet, I have to specify them and their
behavior right in the test (if I don't want to break the process I've just
started). That's why I really need mocks. Then I can take another use case
or implement one of the mocks I used as a real object and so on. Thus, mocks
allow me to go top-down and implement only the things I really need, not the
things I think I'll need.

Are there other, maybe better, approaches?

Concerning TDD popularity… I'm not sure TDD plays the role it should in
Smalltalk community.

Messing with Smalltalk for about 7–8 years, I can't say I often see real TDD
code. About 50–70% (depending on Smalltalk dialect) of frameworks I use have
no tests at all. The rest often looks being tested a posteriori. Perhaps,
Pharo is the only exclusion…

And if TDD is really popular and widely used, why do we have so much
regression bugs even in core subsystems even in commercial Smalltalks?

Please, correct me if I'm wrong.

2010/11/23 laurent laffont <laurent.laffont at gmail.com>

> On Tue, Nov 23, 2010 at 5:39 PM, Luc Fabresse <luc.fabresse at gmail.com>wrote:
>
>> Hi Dennis,
>>
>>  Yes, TDD is highly popular and encouraged in the Smalltalk community.
>>  And mocks are not necessary in most cases.
>>
>
>
> Hi Luc,
>
> why Mocks are less necessary in Smalltalk than in other
> (Ruby/Python/whatever...) languages ? Do you have some examples / link ?
>
> Sometimes I think a mocking library should be in PharoCore so I don't need
> to write my own mocks.....
>
>
> Cheers,
>
> Laurent
>
>
>
>
>>
>> #Luc
>>
>>
>> 2010/11/23 Dennis Schetinin <chaetal at gmail.com>
>>
>> How is it compared to Mocketry (http://www.squeaksource.com/Mocketry.html)?
>>> SMock?
>>>
>>> BTW, isn't TDD without mocks a bit incomplete? And is TDD popular among
>>> smalltalkers actually?
>>>
>>> 2010/11/22 Mariano Martinez Peck <marianopeck at gmail.com>
>>>
>>> This is cool Anindya. I don't need mocks right now, but I will keep it in
>>>> mind!
>>>>
>>>> I cc'ed Pharo-dev mailing list.
>>>>
>>>> Cheers
>>>>
>>>> Mariano
>>>>
>>>> ---------- Forwarded message ----------
>>>> From: Anindya Haldar <anindya_haldar at yahoo.com>
>>>> Date: Mon, Nov 22, 2010 at 10:11 AM
>>>> Subject: [Pharo-users] TestMock: a full featured mock testing framework
>>>> now available in SqueakSource
>>>> To: pharo-users at lists.gforge.inria.fr
>>>>
>>>>
>>>> Dear Pharoers,
>>>>
>>>> TestMcok is a full featured mock based test framework that I am very
>>>> glad to contribute to the community. It is in squeaksource under the project
>>>> name TestMock. Please feel free to try it, and feedback will be greatly
>>>> appreciated. The wiki section includes a brief how-to guide with code
>>>> examples.
>>>>
>>>> Regards,
>>>> Anindya Haldar
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Pharo-users mailing list
>>>> Pharo-users at lists.gforge.inria.fr
>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Dennis Schetinin
>>>
>>
>>
>


-- 
Dennis Schetinin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gforge.inria.fr/pipermail/pharo-project/attachments/20101124/b598f30c/attachment.htm>


More information about the Pharo-project mailing list