I often use Excel for defining data when talking with business. Usually, each excel table will end-up as a table in my database. These tables also store test data so it is very useful to base integration tests on this data instead of generated dummy one as Roo is currently doing.
Using Roo I saw opportunity to generate Roo script for defining entities directly from excel running the macro.
I have created the VB script and an example excel spreadsheet file so that you can see how data is defined and test it for yourself.
Before running it set persistence parameters in VB code based on your database. Mine settings look like this:
You can always edit these settings in generated file roo.txt file if you don't want to do it in VB.
Print #1, "persistence setup --provider HIBERNATE --database MYSQL"
Print #1, "database properties set --key database.url --value jdbc:mysql://localhost:3306/rooexcel"
Print #1, "database properties set --key database.username --value root"
Print #1, "database properties set --key database.password --value dummy"
To generate java code run roo.txt file using "script --file roo.txt"
Data in attached excel file is fake but I have tried to include as much as possible data definition for a reasonable good test for Roo generation. VB script is still not generating properly many-to-many relationships but I am working on it.
Finally my question.
I am interested in extended Integration test to load data from excel before running the test. Currently I have to push-in DoD's init method and replace data load code with my code for loading data from excel. Furthermore I have to set Rollback to false to leave data in database after the test.
It would be nice if I don't need to do this. There must be better place to plug code for data import.
I would like to hear your thoughts where you would plug data import code in the Roo project.