Re: Best Way to Test Against a Database
- From: "jehugaleahsa@xxxxxxxxx" <jehugaleahsa@xxxxxxxxx>
- Date: Tue, 13 May 2008 12:49:53 -0700 (PDT)
On May 13, 1:14 pm, Michael Justin <michael.jus...@xxxxxxx> wrote:
jehugalea...@xxxxxxxxx wrote:
I really don't care whether my SQL does what it's supposed to do, just
that I have my CommandText, CommandType and Parameters set up
correctly.
If your database client library (and the server) supports the concept of
"prepared" statements, this would be a very easy way to verify the
correctness of the SQL statements without actually executing the
command. "Preparing" a statement will send the SQL to the server and the
server can use the SQL to build a query plan. If the SQL is invalid, the
server will complain (by raising an exception).
Usually I test all statements using a list (array) of SQL strings which
will be iterated by the unit test. In a perfect test environment, every
SQL would be wrapped in one test case. The test will then run over all
SQL statements even if some of them fail.
This is my recommended reading for testing:
xUnit Test Patterns: Refactoring Test Code (Addison Wesley Signature
Series) by Gerard Meszaros
Hope this helps(tm)
--
Michael Justin
SCJP, SCJA
betasoft - Software for Delphi™ and for the Java™ platformhttp://www.mikejustin.com-http://www.betabeans.de
How well does this verify the parameters that I set?
.
- Follow-Ups:
- Re: Best Way to Test Against a Database
- From: Michael Justin
- Re: Best Way to Test Against a Database
- References:
- Best Way to Test Against a Database
- From: jehugaleahsa@xxxxxxxxx
- Re: Best Way to Test Against a Database
- From: Michael Justin
- Best Way to Test Against a Database
- Prev by Date: Re: How to fill a generics List with reflection?
- Next by Date: Re: How to fill a generics List with reflection?
- Previous by thread: Re: Best Way to Test Against a Database
- Next by thread: Re: Best Way to Test Against a Database
- Index(es):
Relevant Pages
|