[Zope-dev] Unit testing, ZUnit

Simon Coles simon@nipltd.com
Tue, 24 Oct 2000 13:34:07 +0100


>What do people think of this? What does DC think of this? Can I
>go ahead and develop it in this direction?

For our XP endeavors, we've developed a testing framework we call 
SimpleTest, which tests our systems using HTTP requests. Tests are 
written in XML, along the lines of:

<?xml version="1.0" ?>
<!DOCTYPE testrun SYSTEM "../multiple_test.dtd">
<testrun description="Tests for read-only form">
   <test>
     <description>This is a very simple tests</description>
     <target_url>http://my.server.name/somewhere</target_url>
     <input>
       <field name="field1">magicroundabout</field>
       <field name="field2">1</field>
     </input>
     <output>
       ... various <condition> blocks to test if the
       returned HTML contains or doesn't contain stuff,
       or the return code was xxx
     </output>
   </test>
   <test>
   ... you can have lots of tests in a test run
   </test>
</testrun>


You can set authentication for a test run, and (crudely) pass 
variables from one test to another.

Tests are stored as XML files and we use CVS to control them.

Our feeling is we will probably need to use PyUnit at some point, but 
for the moment this is serving our needs OK. Using this we have been 
able to unit test most of the bits of the Zope applications we write, 
including where those applications link into other web-accessible 
systems. The framework is written in Python and we've been adding 
bits to it as needed.



Simon
-- 
--------- My opinions are my own, NIP's opinions are theirs ----------
Simon J. Coles                                 Email: simon@nipltd.com
New Information Paradigms                  Work Phone: +44 1344 753703
http://www.nipltd.com/                     Work Fax:   +44 1344 753742
=============== Life is too precious to take seriously ===============