You can wrap the subclassing and the \removeFromSystem with
SystemAnnouncer uniqueInstance  suspendAllWhile: [ ]

2015-10-24 20:43 GMT+02:00 Peter Uhnák <i.uh...@gmail.com>:

> Hi,
>
> is it possible to do fast, non-system wide class subclassing in tests?
>
> Currently I would do something like
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> MyTest>>testSomething
>     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?
>
> Thanks,
> Peter
>

Reply via email to