Delete from csv files

Hi all,

I’m using liquibase to load/delete test data with junit in an enviroment where calling Liquibase.dropAll() on every tearDown is very expensive since I’ve got a lot of Oracle’s specifig queries and regenerating the database for each test method takes a lot of time (30 minutes average).

So I’m migrating to generate the database a single time before running all the test and let each test to simpli add/delete their test data.

The thing is I’m loading the test data through and csv files, and I’ll like to know if it’s possible to add support for to work with csv also in such a way I can use the same csv definition for add/delete.

I think this could be a practicall addition, specially in cases where I have to add values to a table that shoule remain with it’s original values after test execution.

… well actually for testing purposes I think it’lll be nice if I can do something like

  1. protected void setUp() throws Exception {
  2.       Liquibase.loadData("changelog.xml");
  3. }

  4. protected void tearDown() throws Exception {
  5.       Liquibase.deleteData("changelog.xml");      

And now that I think of, maybe some test support like this will be better…

  1. @Test
  2. @Transactional
  3. @LiquibaseTestDataChangeSets("changelog1.xml")
  4. public void testWithLiquibase() {
  5. ....
  6. }

And the test support to be in charge to add before the method execution and deleting after, giving me the possiblitiy to have different group of changesets for each test methods.

I hope it doesn’t sound to crazy, but since in my project we already use Liquibase for development, I though something of this could be of help to avoid having a tool for development (liquibase) and another for testing (ie: dbunit) each with it’s own way of representing the same information.

Best regards