Monday, June 12, 2006

Hyperjaxb3 roundtrip tests

Roundtrip tests are used within the integration testing in order to check if the generated O/R mapping (be it HBM files or annotations) are allright.

Typical roundtrip test senario is as follows:

  1. Unmarshall the file/resource.

  2. Save the unmarshalled object into the database, memorize the id.

  3. Load the object from the database by the memorized id.

  4. Compare unmarshalled and loaded objects, check identity.



I've already implemented a roundtrip test case for HBM file-based Hibernate mappings (see org.jvnet.hyperjaxb3.hibernate.roundtrip.RoundtripTestCase). You only have to subclass this class in the target package and specify which sample files should be used for testing (see org.jvnet.hyperjaxb3.hibernate.roundtrip.tests.RoundtripTestCaseTest). The tests runs versus the in-memory HSQLDB database, database schema is automatically generated, very easy to use.

I'll need such a roundtrip test for each for the target ORM platforms.

1 Comments:

Blogger Nathan said...

Hibernate versioning, unfortunately, seems to screw this up.

7:50 AM  

Post a Comment

<< Home