Have you ever wanted to run all of your jUnit tests from within Eclipse? It is pretty easy if they are in the same package, but if you have a hierarchy of packages, you are out of luck! I learned quite a few jUnit tricks tonight, even found the exact code I was looking for. You can read about some annotation-based test suites at this site. This guy gave me the exact code I was looking for, maybe someday they will add this feature directly to jUnit!
I’m still digging Unitils as well… I found a cool annotation to rollback the transaction for a specific test case. This is kind of nice when you don’t want your jUnits messing up your database! Check this out…
@Test
@Transactional(TransactionMode.ROLLBACK)
public void validateLoad() {…}
February 2nd, 2009 9:21 am
Try using spring test framework. There a transactionconfiguration defaultRollBack=true
So after each test a rollback is done. Now you don’t need to write tearDown/@After method to clear your DB