DbSetup 1.0 API

DbSetup allows populating a database before executing automated integration tests (typically, DAO/Repository automated tests).

See:
          Description

Packages
com.ninja_squad.dbsetup  
com.ninja_squad.dbsetup.bind  
com.ninja_squad.dbsetup.destination  
com.ninja_squad.dbsetup.generator  
com.ninja_squad.dbsetup.operation  
com.ninja_squad.dbsetup.util  

 

DbSetup allows populating a database before executing automated integration tests (typically, DAO/Repository automated tests). Although DBUnit, which is a great project, allows doing the same thing and much more, it's also harder to use and setup. And in our experience, in 98% of the cases, DBUnit is only used to pre-populate a database before executing every test method. This is the task on which DbSetup concentrates.

The philosophy of DbSetup is that DAO tests should not have to setup the database, execute tests, and then remove everything from the database. Instead, a single setup method should be used to delete everything from the database (whatever the previous test put in it, or the initial state of the database tables), and then populate it with the data necessary to execute the test.

Another design choice of DbSetup is to provide an easy to use and simple Java API to populate the database, rather than loading data from external XML files. Using a Java API has several advantages:

The DbSetup class and the DbSetupTracker classes are the main entry points to the API that an automated test will use. Look at their javadoc below for example usage.