grouparchy.testing

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.

Updated on 22 November 2008

Imported from Plone on Mar 15, 2021. The date for this update is the last modified date in Plone.

Comments

comments powered by Disqus