HibernateDaoTestSetup

!! moved to http://code.google.com/p/webical/wiki/HibernateDaoTestSetup !!

For the daos that make use of hibernate DBunit is used to insert test data before each test. In order to use dbunit for the test (and set up hibernate aswell) sublcass org.webical.dao.impl.DataBaseTest (located in src/test/java).

Configuring dbunit

The configuration of dbunit is located in src/test/resources/dbunit-test-configuration.xml. The following properties are used:
  • driverclass - the class of the jdbc driver used for the connection
  • url - the url of the jdbc connection
  • username - the username used to connect
  • password - the password used to connect
  • dialect- the dialect used by hibernate to talk to the driver

Adapting the dataset inserted before each test

The dataset inserted by dbunit is located in src/test/resources/dbunit-test-dataset.xml. You can add additional elements to this file in order to insert them before each test. To try out the test data run org.webical.dao.impl.DataBaseTest in eclipse.

Resources

-- IvoVanDongen - 28 Sep 2006

Topic revision: r2 - 28 Jan 2008 - 10:24:23 - MattijsHoitink
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback