[Pharo-dev] Unifying Testing Ideas

Sean P. DeNigris sean at clipperadams.com
Mon Dec 2 16:13:52 EST 2013

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.
    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.

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.

More information about the Pharo-dev mailing list