1

We're using Maven 3.0.3, MySql 5.5, JUnit 4.8.1, and Liquibase. Here's what we would like to do. I would like to spin up a MySQL database, run our liquibase database scripts against it, and then run our JUnit tests, using this newly-created database as the datasource. If someone knows of a way to do this using Maven, know that any sample script you post will get more votes than you know what to do with -- and the respect you so dearly deserve.

I realize that the H2 in-memory database supports a MySQL mode, but we don't want to use that. We want to get as close to the real thing as possible.

Dave
  • 15,639
  • 133
  • 442
  • 830
  • Check out [this (How to initialize in memory hsqld using spring via script)][1] post. [1]: http://stackoverflow.com/questions/9329283/how-to-initialize-in-memory-hsqldb-using-script-via-spring – John B Mar 11 '13 at 17:10

1 Answers1

1

Steps:

  1. Use the Maven SQL plugin to create a database.
  2. Use the Maven liquibase plugin to run your scripts.
  3. Run your tests (standard surefire).
  4. Use the Maven SQL plugin again to drop the database, so you can start fresh the next time.
Peter Bratton
  • 6,302
  • 6
  • 39
  • 61
  • Very interesting! I'm going to play around with this to see if I can get it to do what I want. – Dave Mar 15 '13 at 21:46