[Pharo-project] [COTDC] 48 - ClassFactoryForTestCase

Alexandre Bergel alexandre.bergel at me.com
Thu Apr 14 23:39:17 CEST 2011


-=-=-=-=-=-=-=-=-=
The class ClassFactoryForTestCase is useful when classes needs to be created during the execution of the test. This avoid polluting your unit tests with dummy and mock classes.
A typical usage of it is:

TestCase subclass: #YourTest
	instanceVariableNames: 'classFactory'

YourTest>>setUp
	classFactory := ClassFactoryForTestCase new

YourTest>>tearDown 
	classFactory deleteClasses.

YourTest>>testIsBehavior
	| cls |
	cls := classFactory newClass.
	self assert: cls isBehavior
-=-=-=-=-=-=-=-=-=

Cheers,
Alexandre

On 14 Apr 2011, at 16:07, laurent laffont wrote:

> Today:  ClassFactoryForTestCase
> 
> Come on guys ! Go Go Go !!
> 
> 
> Comment Of The Day Contest - One Day One Comment
> Rules: 
> #1: Each day a not commented class is elected. Each day the best comment will be integrated with name of the author(s).
> #2: If you cannot comment it, deprecate it.
> Results: http://code.google.com/p/pharo/wiki/CommentOfTheDayContest
> 
> Laurent
> 

-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.








More information about the Pharo-project mailing list