[Zope] Strategies for testing generated sql?

Paul Winkler pw_lists at slinkp.com
Wed Apr 12 14:16:26 EDT 2006


On Wed, Apr 12, 2006 at 06:51:18PM +0200, Marco Bizzarri wrote:
> The problem is what you want to test. I'm not familiar with Zope 3,
> therefore I'm talk on the base of ZSQLMethod.SQL.SQL from Zope 2.
> 
> If I understand correctly, you've some high level construct which creates an
> nvSQL instance. 

Correct. 

> Now, if you put yourself at the end of the line, what you
> need to do is to parse the output of nvSQL, in order to see if the generated
> SQL is correct.
> 
> What you're doing therefore is to test whether nvSQL is able to generate
> correctly the SQL. But I think this is not what you want to test. You could
> safely assume that, given the proper input, nvSQL will generate the proper
> output.
> 
> Therefore, what you should test is that the generated nvSQL has the
> appropriate characteristics.

Exactly!  

I am also open to suggestions on what kind of characteristics
I should be interested in.  I have never written tests of generated
SQL before.
 
> I will try to post a sample for Zope2, just to give an idea of what could be
> done.

That would be very helpful, thank you.

-- 

Paul Winkler
http://www.slinkp.com


More information about the Zope mailing list