tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Karalus <andreas.kara...@googlemail.com>
Subject RE: Rollback transactions in unit testing
Date Tue, 30 Sep 2008 20:05:19 GMT

Marcin,
the strategy you suggest should also work and is especially good for
prototyping or smaller projects. 

In our case where we have a huge application with (>1.5 Mio LoC, > 1000
EJBs, > 100 database tables with complex relationships) we cannot drop (or
empty) and create tables in junit tests. This would heavily impact the
development and testing.
this is the reason why in such cases a rollback after a unit test instead of
makes sense. 

regards,
andreas 



Marcin Kwapisz-2 wrote:
> 
> [Marcin Kwapisz] 
> I do not understand why you want to rollback committed transaction,
> especially in unit test. Even, I do not know how to do it in JEE
> application. 
> Maybe our way will suit you:
> 
> 1. set drop and create strategy in persistence.xml (property name depends
> on JPA provider, we have separate file for unit testing)
> 2. Start OpenEJB (for example: perform ejb lookup) -> database should be
> empty now
> 3. Create initial set of data in tables
> 4. Run test
> 5. Shutdown OpenEJB
> 
> Now, you can repeat steps 2-5 for another tests
> 
> Regards
> -- 
> Marcin Kwapisz
> Division of Computer Networks
> Technical Univeristy of Lodz, Poland
> 
> 
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Rollback-transactions-in-unit-testing-tp19724095p19749405.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


Mime
View raw message