[Pharo-dev] Unifying Testing Ideas

Dennis Schetinin chaetal at gmail.com
Tue Dec 3 00:16:01 EST 2013


I see the only correct way to build a good testing environment: tests
should be basically objects, not methods.


--

Best regards,


Dennis Schetinin


2013/12/3 Sean P. DeNigris <sean at clipperadams.com>

> Attila Magyar wrote
> > The reason for having the base class is to verify the expectations at the
> > end of the tests automatically. Doing this manually is possible (context
> > assertSatisfied), but probably people would forget it without this
> > automatic mechanism. In Java for example, mock libraries use custom JUnit
> > runners to do this, but I haven't found something like this in SUnit. If
> > there is a better way to do this please let me know.
>
> I understand the motivation. My question is how do we create appropriate
> hooks so that we don't get into these conflicts?
>
> I made a few enhancements to BabyMock:
> - anyArgument now inst var of BabyMockTestCase, similar to BmAnyMessage
> - #does: now optionally takes arguments
>
> The second one turns:
>
>     handle := FMOD_SYSTEM new.
>
>     library should
>         receive: #FMOD_System_Create:;
>         with: [ :a |
>                 a = handle
>                         ifTrue: [ handle := a. handle handle: 20. true ]
>                         ifFalse: [ false ] ];
>         answer: 0.
>     library should
>         receive: #FMOD_System_Init:;
>         with: [ :a | a = handle ];
>         answers: 0.
>
> ...into:
>
>     library should
>         receive: #FMOD_System_Create:;
>         with: FMOD_SYSTEM new;
>         does: [ :h | h handle: 20. 0 ].
>     library should
>         receive: #FMOD_System_Init:;
>         with: [ :a | a handle = 20 ];
>         answers: 0.
>
> ... eliminating the temporary, and the separate #with: and #answer: send in
> the first expectation.
>
> I pushed them to http://smalltalkhub.com/mc/SeanDeNigris/FMOD/main/ since
> that's where I was using them, but if you give me access to the BM repo and
> you like the changes, I will clean them up and push there.
>
>
>
> -----
> Cheers,
> Sean
> --
> View this message in context:
> http://forum.world.st/Unifying-Testing-Ideas-tp4726787p4726855.html
> Sent from the Pharo Smalltalk Developers mailing list archive at
> Nabble.com.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20131203/218f2e53/attachment-0002.html>


More information about the Pharo-dev mailing list