SUnit with too many tests

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

SUnit with too many tests

hernan.wilkinson
Hi,
 I just wanted to share with you that we had problems running too many tests with SUnit because of memory use.
 We have around 15,000 unit tests and while running them the memory grew from 80 megs to 700 megs (we use VisualAge) and therefore, the machine became really slow...
 Anyway, we realized the memory was not freed because the tests referenced objects from their instance variables. Therefore we added a method that puts "nil" in all test's instance variables (but 'selector').
 The amazing thing is that not only running the test now do not makes the image to grow but it takes 50% less time to run them! So anyway, we are happy with that and maybe this change is useful to other people.
 Here is the code:

TestCase>>runCase

    [self setUp.
    self performTest] sunitEnsure: [self tearDown;cleanUpInstanceVariables]

TestCase>>cleanUpInstanceVariables

    (TestCase allInstVarNames size + 1) to: self class allInstVarNames size do: [ :index | self instVarAt: index put: nil ]


Bye,
Hernan.