Hacker News new | ask | show | jobs
by lsb 5627 days ago
What are the benefits of holding onto each instance?
2 comments

I don't believe Test::Unit does this intentionally; it's just a side-effect of the implementation (load all tests into an array, and iterate over the array).
JUnit stores all of the meta data about each test case in the test instance itself, so all of the reporting is based off of these classes. It has always puzzled me why it was done this way, why not just store a collection of "meta-data" objects and report off of them (allowing the test instances to be garbage collected,) but I assume it would break most of reporting the plugins/tools to change it now.

Note this is for the older 3.x versions of JUnit, I'm not 100% this is still true for the 4.x line.