Hello Jose

About problem 1: You can use HSQL

About problem 2: You can run the tests against HSQL, so you can the
connection properties inside your test directory, so those tests would just
run against your embeddable database. An example can be found here:

http://fisheye.codehaus.org/browse/mojo/trunk/mojo/mojo-sandbox/hibernate3-m
aven-plugin/src/test/project-jdk15/src/main/resources/database.properties?r=
1673

Regards

Johann Reyes

-----Original Message-----
From: Jose Gonzalez Gomez [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 11, 2006 7:53 AM
To: Maven Users List
Subject: Best practices in testing Hibernate/EJB3 POJOs (or doing database
tests)

Hi there,

I would like to hear about what you're doing to test your Hibernate/EJB3
POJOs (if you're doing at all). I have a project with some of them, and I
have the following concerns:

First of all, I may test them just ignoring persistence (already done). No
problem here, just a bunch of TestNG tests running smoothly under Maven2. I
think this is important, as I'm developing a library mainly intended to be
used as annotated Hibernated POJOs, but maybe people using it prefer another
persistence api. What do you think?

Then I thought about testing the library including the persistence stuff,
but this brings some problems:

Problem 1: Whenver building the project, publishing the site, etc. you must
have access to a runnning database in order to perform the tests. I'm
currently running a postgresql database, but it may be cumbersome for users
wanting to download and hack the sources. Maybe this could be solved using
some kind of embeddable database? Or maybe I could create several profiles
(never done this) and activate database tests only under demand?

Problem 2: Having database tests involves having configuration data written
down in some configuration file (the jdbc URL, user, password, etc.
hibernate.cfg.xml) or even in the pom (jdbc driver dependency). It's kind of
putting in the sources of the library some information that may be only of
interest to me in my current environment. How to solve this? Again using
some kind of embeddable datasource for tests? Using source filters? (again,
I haven't done this before, so I don't know if it's suitable)

Best regards
Jose



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to