In working on this functionality to test the support for "database
generated" values, I ran across an interesting issue with unit testing
this functionality.  Basically, the only real way to test this in a
consistent fashion across all databases is to apply triggers to the
database in use for testing (after schema generation).

This is the same reason why I always get failures on the tests relating
to stored procedure support.

I think we should come up with a unified way to approach this.  So I'll
throw out my proposal as a starting point and see if anyone has better
solutions.

The basic idea is to have the individual tests in this category register
"additional db objects" with the base test case class; these would be
used during setUp() and tearDown() processing.  DatabaseObject might
look like:

interface DatabaseObject {
    void doCreate(Connection conn);
    void doDrop(Connection conn);
}

I am thinking of a new test base class that tests relying on non-table
db-object creation could extend; or even add this functionality to the
existing TestCase.  It would add a single new method "DatabaseObject[]
getAdditionalDatabaseObjects(Dialect dialect)" which it would call
during setUp() processing.  The reason for this instead of just
overriding setUp()/tearDown() would be to only execute this stuff when
we actually rebuild the session fatory.  

The simple option would be to have each test class do this work
themselves in setUp() and tearDown() for each test execution even though
we are not necessarily creating/dropping the schema at that frequency.

Anyway, thoughts?

Steve



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to