On 4/12/06, Paul Winkler <pw_lists@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