[Zope] Strategies for testing generated sql?

Marco Bizzarri marco.bizzarri at gmail.com
Fri Apr 14 03:27:22 EDT 2006


On 4/12/06, Paul Winkler <pw_lists at slinkp.com> wrote:
>
>
>
> Functionally, we are missing some important testables:
>
> * we have no way to verify that these queries are syntactically correct
> sql.
>
> * we have no way to verify that these queries behave as expected against
>   a sample data set.
>
> How do people test this sort of thing? Do you go whole-hog and
> fire up MySQL or whatever?  Or use gadfly? sqlite? or what?
>
> Are there other tools I should know about?


Sorry, It is taking a little more than I expected to prepare the sample.
However, I can provide some idea on this topic. We do this using
ZopeTestCase.

Basically, we have a test database (postgresql, but it can be used for
whatever transactional database). Each user has its own database, based on
its username.

The test does actual queries on the test database. At the end of each test
(single test, not test suite), there is a rollback (if you're using a Z
Database Adapter, this is done automatically by the transaction machinery).

So, each single test runs with a "fresh" copy of the database.

Regards
Marco



--
Icube Srl
http://www.icube.it/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20060414/c370c021/attachment.htm


More information about the Zope mailing list