Srepfler Srgjan on 29/12/05 17:14, wrote:
Did anyone have success in integrating dbMonster or dbUnit with a maven2 j2ee project? Could you paste some pom's or how-to's on how you did this? Thanks and Happy Holidays

I use DbUnit and the only interaction it has with maven2 is as a dependency.

My unit tests are set up with a base class that uses DbUnit. I don't inherit the DbUnit testcase.

I used some code from the DbUnit website to extract a DTD from the schema with which I write the test data in xml.

I have one xml file per table with test data for that table in it.

I wrote a method in my base class to insert the test data in setup, and the subclass specifies which tables it needs data in.

I do a delete on all tables first.

The base class runs a transaction which wraps the deletes, the test data inserts and the test itself in a transaction and I roll back the transaction at the end.

It's not perfect but it's almost there.


Adam

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to