[Pharo-users] fast subclassing/class creation in tests

Peter Uhnák i.uhnak at gmail.com
Sat Oct 24 14:43:51 EDT 2015


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...
URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20151024/e456dbe9/attachment.html>

More information about the Pharo-users mailing list