I try to write an big test class.
I'm using Junit, Hibernate and TopLink and H2 database. Before this I used EJB3Unit (including Hibernate and H2).
My test class has 57 test methods. If I run all test at once randomized one or more test fails. If I run each test alone, I get no error.
Has anyone an idea what's going wrong? And how I can prevent this?
- For each test method I create a new in memory database with a different name.
- I create a new entitymanagarfactory and entitymanagar instance.
- I've disabled second level caching.
- I create all table via script (no error occurs so database is really fresh).
- I do some db actions and test.
- I clear session and em.
- I drop all object in my in-memory database
- I shut down the database
- I close em and emf.
Have I to do more?
Thanks a lot...