jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Korver, Aaron" <Aaron.Kor...@Fiserv.com>
Subject RE: Cactus DBUnit integration (Was:Contacting the container from beginXXX())
Date Mon, 09 May 2005 19:04:16 GMT
Gili,
See the dbunit howto[1] page under the section called "Database setup with
your own TestCase subclass.  Since ServletTestCase is already a TestCase
subclass, I've subclassed it further.  Note that I should probably refactor
it to make a DBUnit decorator class. (favor composition over inheritance)
So, I have a class called "ServiceTestCase" which extends ServletTestCase
and contains some helper methods for dbunit.  Then in the setup() and
teardown() methods of my TestClasses (which extend ServiceTestCase) I follow
the steps shown at the dbunit site.  I hope that this makes sense.

Aaron Korver

[1]http://www.dbunit.org/howto.html



> -----Original Message-----
> From: Gili [mailto:cowwoc@bbs.darktech.org]
> Sent: Monday, May 09, 2005 1:31 PM
> To: Cactus Users List
> Subject: Re: Contacting the container from beginXXX()
> 
> 
> 
> 	DBUnit looks nice but how would you integrate with it 
> Cactus? Each one 
> requires you to extend a different class and Java doesn't do multiple 
> inheritance.
> 
> Gili
> 
> Korver, Aaron wrote:
> > [snip]
> > 
> >>Why don't you simply fill the database with the right values? 
> >>No need for
> >>any hibernate mapping for this! It can be done in several 
> >>ways, with a SQL
> >>script, by saving a database dump and reloading it, etc.
> > 
> > [snip]
> > 
> > May I also suggest using dbunit[1]?  We have been using 
> this successfully in
> > our environment to setup a fixture and restore a DB to a 
> known state.  If
> > you use it with an in-memory DB you can get pretty good 
> performance.  You
> > just want to only do these tests nightly.  Then mock out 
> your DB and run the
> > "logic" tests using mocks.  Remember that developers are 
> lazy, so if your
> > tests take to long to run, then no one will use them.
> > 
> > [1] www.dbunit.org 
> > 
> > Aaron Korver
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message