i want to test my data access layer (DAO). for that i want to set up state before each test with hsqldb. i am using memory hsqldb so my tests are running quickly.
For the whole test suite i only need to export my database schema (ddl) once to the database.
my first ideas: 1) doing schema export in setUp() or in constructor -> problem: in JUnit for each test case you get a new instance of your test class, i.e. a new export is done for each test case. 2) doing schema export before running test suite -> problem: for i am using memory database the schema is dropped straight away. test suite is working on an empty schema 3) exporting schema in static initializer -> mabe that is sensible?
-any more ideas? maybe memory database is so quick that it does not matter if i am exporting the schema for each test case? -further more it is not clear to me when memory hsqldb database is dropped. maybe after first opened Connection is garbage collected?
another question: DbUnit is using xml files. because i/o regarding filesin files is slowing down tests, has anybody had bad/good experience with performance of DbUnit?