[Pharo-users] fast subclassing/class creation in tests
nicolaihess at gmail.com
Sat Oct 24 18:22:00 EDT 2015
You can wrap the subclassing and the \removeFromSystem with
SystemAnnouncer uniqueInstance suspendAllWhile: [ ]
2015-10-24 20:43 GMT+02:00 Peter Uhnák <i.uhnak at gmail.com>:
> is it possible to do fast, non-system wide class subclassing in tests?
> Currently I would do something like
> cls := SomeParent subclass: #Something.
> "... do some tests ..."
> cls removeFromSystem
> This is for example what ClassTest is doing.
> However this is very slow, and even for small tests suite --- just ten (so
> far) test methods it takes over ten seconds to test it all, which is quite
> bad for TDD.
> My guess is that since it has to write to class to the environment and
> disk and then remove it it takes a while:
> [ Object subclass: #Something ] timeToRun. "0:00:00:00.021"
> [ #Something asClass removeFromSystem ] timeToRun. "0:00:00:00.526"
> is it possible to speed it up? Create classes that are fast to remove?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Pharo-users