Upon more research it seems that JUnit creates one instance of each test
class per fixture and keeps that reference until the end of the
suites.All run. That means any state in the test hangs around as well,
which slowly adds up as the test runs. This is particularly problematic
for tests such as ClosedObjectTest which ends up with 3150 instances +
state for each:
Options to reduce footprint include:
- Make sure tests have tearDown() methods that null out fields.
- Rework tests such as ClosedObjectTest to not have so many fixtures.
- Make a request to JUnit that the Suite dereferences the test after it
runs.
- Make the tearDown method in BaseJDBCTest null out fields. (I think
this means that fields for tests would have to be public.)
- Something else?
Thoughts on this are greatly appreciated.
Kathey