DZone
Java Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Java Zone > DbUnit Express 1.3 is Even Easier to Use and Still Better

DbUnit Express 1.3 is Even Easier to Use and Still Better

Jakub Holý user avatar by
Jakub Holý
·
Sep. 14, 11 · Java Zone · Interview
Like (0)
Save
Tweet
4.98K Views

Join the DZone community and get the full member experience.

Join For Free

The DbUnit Express 1.3.0 (a thin wrapper around DbUnit to speed up DB testing) released recently 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.

 

From http://theholyjava.wordpress.com/2011/09/04/dbunit-express-1-3-is-even-easier-to-use-and-still-better/

Express

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Transactions vs. Analytics in Apache Kafka
  • Take Control of Your Application Security
  • Upload Files to AWS S3 in JMeter Using Groovy
  • Flutter vs React Native. How to Cover All Mobile Platforms in 2022 With No Hassle

Comments

Java Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo