SUnit Resource Problems

Chris Muller afunkyobject at yahoo.com
Thu Aug 5 17:13:12 UTC 2004


> I'm trying to set up an SUnit test that uses a TestResource. The
> "resource" is a bunch of traits that need to be created one time at the
> start of the test run and deleted at the end of the test run, and are
> looked at but not modified by any of the tests (so they don't need to 
> be
> cleaned up between tests; it would take far too long).

Hi Peter, I ran into this very challenge years ago while building Magma.  I
didn't want to delete and recreate a new database after every test.

My solution was less than ideal, but it has worked for years.  I implemented
#setUpSuite and and #tearDownSuite on the class-side of my TestCase class. 
These are called by a new method I added to TestSuite.

If you want to see the code, load MagmaTester and look at the package "Ma
Armored Code" (e.g., the category "*ma armored code" in TestSuite).

 - Chris



More information about the Squeak-dev mailing list