views:

41

answers:

2

I have a three tier application under development and am creating integration tests for DAOs in the persistence layer. When the application runs in Websphere or JBoss I expect to use the connection pooling and transaction manager of those application servers. When the application runs in Tomcat or Jetty, we'll be using C3P0 for pooling and Atomikos for transactions.

Because of these different subsystems, should the DAO's be tested in a fully configured application server environment or should we handle those concerns when integration testing the service layer? Currently we plan on setting up a simple JDBC data source with non-JTA (i.e. resource-local) transactions for DAO integration testing, thus no application server is involved....but this leaves me wondering about environmental problems we won't uncover.

+1  A: 

I think you're on the right track with this line of thinking. If possible you should set up a continuous integration server (e.g. Hudson) that runs your production environment. That way you can develop with pretty high confidence using Tomcat etc., running tests against your local setup, and when you check in your code be sure that those same tests are being run against the real deal.

roufamatic
We have Hudson already up and running. I guess I was just wondering if the DAO tests should be run in an app server...or just the end-to-end tests.
HDave
+2  A: 

Besides testing each module using unittests, the integration test should test groups of modules.

I don't want to be pedantic but in therorie this is folowed by system test for black box testing by QA.

For smaller projects this may not be feasible

stacker
Fully agree - I understand integration testing as testing the full path from the client to the database. Even though testing the the service layer only might be more than just unit testing.
Andreas_D
My understanding of the definition of integration test to be two or more modules or one module and an external resource. Regardless of definitions though, should DAO tests should be run in an app server?...or just the end-to-end tests?
HDave