unit testing CGI scripts?

Lee, Dustin dlee at rightnow.com
Tue Feb 10 15:39:09 CET 2004


How about testing CGI scripts that access a database (I expect this is the norm)?

I find writing unittests with non-cgi and non-database code very beneficial and pretty straight forward.  I have yet to figure out how to do this with cgi and database coding.  I'm starting to appreciate why pure functional languages (Haskell, etc) really laud the praises of doing "side-effect free" programming.  Of course it's hard conceive of using a database with out actually changing it....

So who out there is doing cgi/db programming and actually testing it?

dustin

-----Original Message-----
From: python-list-bounces+dlee=rightnow.com at python.org
[mailto:python-list-bounces+dlee=rightnow.com at python.org]On Behalf Of
Jim Hefferon
Sent: Tuesday, February 10, 2004 6:00 AM
To: python-list at python.org
Subject: unit testing CGI scripts?


Hello,

Does anyone have suggestions for unit testing CGI scripts?  For
instance, how can I set the FieldStorage to have certain values?
Do I have to go with a dummy FieldStorage class?  And is there a
better way to check the output than to compare the resulting (sometimes
very large) strings?  Changing the HTML slightly means that I have to
edit the tests and that defeats the purpose of the tests, to 
some extent.  I'd greatly appreciate any tips.

Thanks,
Jim
-- 
http://mail.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list