DbUnit Express 1.3 is Even Easier to Use and Still Better

The DbUnit Express 1.3.0 (a thin wrapper around DbUnit to speed up DB testing) released today introduces features that make it even easier to write a DB unit test, the most interesting ones are the introduction of EmbeddedDbTesterRule which can automatically execute its onSetup thanks to JUnit's @Rule (example) and the addition of setDataSet(fileName), which searches for a data set file of the given name on the classpath etc. and loads it.

See the updated project page and example tests.

Other changes of interest:
  1. The project was now officially renamed to dbunit-express (and root package changed to net.jakubholy.dbunitexpress), so update your Maven dependencies and code
  2. Upgraded to latest DbUnit (2.4.8, was 2.4.7)
  3. Added slf4j-simple to dependencies so that users don't need to do it themselves anymore - those who don't want it may just exclude it
  4. Added EmbeddedDbTesterRule which can call its onSetup automatically under JUnit 4
  5. Added setDataSet(String) that tries to find a file of the given name in testData/ or on the classpath and loads it
  6. When there is a FileNotFoundException for the ddl, report the working directory, check if testData/ self exists
  7. Added comment to onTearDown() saying that it does nothing and thus doesn't need to be called, updated test classes accordingly
  8. Added SimpleNonExtendingEmbeddedDbJUnit4Test to show usage with JUnit 4
  9. When it is detected in onSetup() that the test database likely isn't initialized, we advice to use Db Creator and report the current working directory
  10. Added method findConfigFile(name) to simplify custom DataSet creation, location of DDL files etc.
  11. Added DatabaseCreator.loadDdl(name) to load an additional DDL, you can also use new DatabaseCreator().setDdlFile("fileOnClasspathOrInTestData.ddl").doCreateAndInitializeTestDb() to init the DB from a custom DDL
PS: As you might have noticed, the project was migrated to GitHub because I couldn't stand Subversion anymore. Its inability to deal with deleted folders was killing me.

Tags: java library


Copyright © 2024 Jakub Holý
Powered by Cryogen
Theme by KingMob