Question

Does anybody know a way to generate complex testdata using an existing database for in memory hsqldb? So my junit tests will be able to use a part of correct data.

The concrete problem is the following:

we have to write junit tests for an existing project to verify the integration will work when we change code (normal testing process) But we already have an existing database. As we just offer services for other components we "just" have services which offer data from db.

But loading the whole database in the hsqldb is to much memory intensive... so i only want to have a part of the data which i can test. There are a lots of references between the tables.

Was it helpful?

Solution 2

The solution for my question is:

  1. Running the existing integration test and catch the sql statements
  2. execute the logged sql statement
  3. create insert statements from the executed sql
  4. read the insert statements into the inmemory hsqldb

thanks to @CAB for the hint!

OTHER TIPS

I never used this feature, but dbunit has it. http://www.dbunit.org/faq.html#extract

I have used dbunit, and I like it. We just create our xml data sets on our own.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top