[Zope-dev] Zope unit testing framework?

Martijn Faassen faassen@vet.uu.nl
Mon, 28 Feb 2000 11:23:02 +0100


Hi there,

Recently I've been reading some books [1] which put emphasis on the idea
of unit testing. At the Python conference Joel Shprentz held a short talk
about doing unit tests in Python [2]

Basically a unit tests are some simple test functions that are associated
with a unit of code (a python module). The tests exercise the code in
the module, and either succeed or fail (there may also be an error due
to an uncaught exception). Each time you change something in the module
you run the associated tests. The idea is that this makes debugging easier, 
catching bugs more quickly and giving better diagnostics. Doing unit tests
in Python isn't hard to do.

I'm having more trouble thinking of a good way to do unit tests in Zope,
though. Partially this is because Zope has various parts (the management
interface for folders, ZClasses, product development), which each may need
a different testing strategy. Partially this is because Zope currently mixes
model and view together (though there are thoughts to do something about
this [3]) -- unit tests are about testing code (methods and such), not
user interfaces. Another problem is that much Zope code is not easy to test
in isolation from Zope. Too much of the code depends on various Zope
facilities (base classes, object database integration).

Has anybody any ideas on how to do unit testing within the Zope framework? I'd
like to try adopting somekind of unit test strategy for my Zope
development.

Regards,

Martijn

[1]
Martin Fowler, ed., Refactoring: Improving the Design of Existing Code,
Addison Wesley Longman, 1999

Kent Beck, Extreme Programming Explained, Addison Wesley Longman, 1999

[2]
http://www.python.org/workshops/2000-01/proceedings/posters/shprentz/shprentz.pdf
http://c2.com/cgi/wiki?PythonUnit

[3]
http://www.zope.org/Resources/Mozilla/ZWiki/ZopeMVC
http://www.zope.org/Resources/Mozilla/ZWiki/ModelViewController