I am new to automated testing and dbUnit. So I would appreciate your advice.
I am going to create a test suite, that will run the following way:
- create an in-memory H2 database
- run DDL scripts to create tables
- run dbUnit to insert initial data (let's call it STATE0) that will be used by all tests.
- run tests
Till there it looks nice for me, but what I don't understand, is how do I revert the database to the STATE0 after a test run and changed the data?
Can I do it with dbUnit?
Or with something else?
Should I recreate the database before each test?
Simple not commiting transactions in tests is not appropriate for me, because the tests will eventually run more than one transaction over may be more than one database connection.