cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Kienenberger <>
Subject Re: testing with cayenne
Date Sat, 10 Nov 2012 14:43:33 GMT
My cayenne tests are all run against an in-memory hsqldb database with dbunit.

For some things, I subclass my <Entity>.java files as
Mock<Entity>.java and provide a mock DAO manager that skips the
database.   The subclassing was because I hadn't set up my references
to entities as interfaces.  I'd probably have just generated separate
mock classes with interfaces if starting fresh.

My newer apps use H2 for testing.   My only issue with H2 is it is not
completely in-memory.   It still uses a file, which makes it more
difficult to run tests in parallel.   On the other hand, it's trivial
to switch between app-specific, shared server, tcp-ip server, and so
on, which makes debugging a failing test far easier.

On Sat, Nov 10, 2012 at 8:26 AM, Michael Gentry <> wrote:
> Hi Emeka,
> We've used before to create a real in-memory
> database to run tests against.  H2 is small and fast and works pretty
> well, plus by creating your schema/data in-memory only, you don't have
> to worry about file permissions or cleanup when your tests are done
> running.
> mrg
> On Fri, Nov 9, 2012 at 6:04 PM, emeka okafor <> wrote:
>> New cayenne user here. I am trying to use cayenne as the orm for an application and
I was wondering how you guys write your unit test? do you test with a real database or do
you have predefined mock objectcontext and son on to be able to write performant test?
>> Thank you.

View raw message