Skip to content. | Skip to navigation

Personal tools


You are here: Home / Blog / grouparchy.testing


by Ross Patterson last modified Nov 23, 2008 03:07 AM
re-use ZODBs for expensive test fixtures

The test fixtures for The Groupery were far too expensive due to lack of unit tests.  They took forever to run making test driven development a pain and discouraging good practice on the team.  I started grouparchy.testing as a pragmatic compromise.  I never finished it but I'd like to do so if anyone else has any interest in this.  The following is from the doctests.

Sandboxed layers allow tests with lengthy ZopeTestCases whose setUp functions are lentghy to build ZODB.FileStorage databases on first run allowing successive runs to use the existing ZODB.FileStorage databases without running the lengthy setUp functions. The ZODB.FileStorage databases will be recreated on next run if they've been deleted allowing one to recreate the test fixture when needed.

WARNING: Sandbox layers give one a lot of rope with which to hang themselves. One should always try write to fast running unit tests instead of tests with expensive setUp functions. If one must live with tests with expensive setUp functions then Sandbox layers can save a lot of time, but only if one is absolutely certain that the test fixture hasn't changed since the layer setUp was last run. When in doubt, delete all ZODB.FileStorage files and run the layer setUp functions fresh.

Related content
The Groupery
Zope 3
OpenID Login


IRC: rossp
Yahoo IM: patterson_ross
AIM: rosspatters
Skype: merpattersonnet

PO Box 7775 #10587
San Francisco, CA

+1 (415) 894-5323