Open Max-Goebel opened 9 years ago
Since a batch functionality is considered also to be part of OASP, could it be also an alternative to do this initialization? or will it be overkill? kind of eating our own dog food :-)
Sorry for last comment author, I didn't realized I was logged in github with other user.
Using the batch layer for initializing the database would be one variant of solution 4 (CRUD-functions). As we have on each layer CRUD-functionalities, we could use each layer for database initialization. But we should decide if we generally prefer the data access layer, logic layer, service layer or batch layer. But the higher the layer, the lower the performance.
In my current project we have official DDL and master-data in src/main/resources/db/migration
and testdata in src/test/resources/db/test
. For tests we use H2 and the rest is done with the productive DB. The testdata is only for the common things to test and needs to be maintained in SQL with the general data-model & migration stuff. For complex test-data we combine this with additional approaches.
How will we initialize database for testing? Which data format will we use to represent the data used to this initialization?
All solutions except solution 1 have to deal with the problem that data changes must be undone before the next test execution starts. For solution 2, DB-Unit provides tools to do this. For solution 3 and 4 the following alternatives exist:
The purpose of this ticket is to clear these questions: