Spring DBunit provides DBUnit add-ons for Spring Framework.
It allows you to easily insert and cleanup test data into the database of your choice.
Use cases examples :
- "pseudo" unit tests on a DAO layer, with an in-memory database like HSQLDB or H2 and a schema automatically created with Hibernate hibernate.hbm2ddl.auto=create-drop.
- GUI integration tests with Selenium, with a persistent database and an existing schema.
- application prototype development, with data reloaded on application startup
Starting from 1.4.0, releases are in Maven Central, all you need to add to your POM is:
<dependency>
<groupId>com.excilys.ebi.spring-dbunit</groupId>
<!-- or spring-dbunit-servlet -->
<artifactId>spring-dbunit-test</artifactId>
<version>1.4.0</version>
</dependency>
For older versions of Spring DBUnit, read the Maven Wiki page.
Note that you need version 1.1.X of DBUnit if you use Spring 3.X
Have a look at these Wiki pages for documentation :
Spring DBUnit is released under the Apache Software License v2.0 (See LICENSE file)