Looking for tips for Integration Testing of a Java EE application
I am working on a Java EE 6 application that consists of multiple components, which are all packaged as separate Maven projects:
MyAppInterface
- OSGi module, contains entity classes, including JPA and JAX-B annotationsMyAppRealm
- OSGi module, contains custom Glassfish LoginModule and RealmMyAppServer
- web application, contains EJBs, EntityFacades, JAX-RS Gateway, a few administrative JSPsMyAppWeb
- web application, GWT app, communicates with MyAppServer via XML/REST
The reason why they are all separated in different projects is for scalability reasons - not everything is deployed everywhere. MyAppInterface
is used by all other projects. Everything is running on Glassfish 3.1.
Now I'd like to introduce the concept of integration testing to this. Leaving out MyAppWeb
for a moment, I'm thinking it'd be ideal to test everything via the JAX开发者_运维技巧-RS gateway.
How would you do this?
Obviously the whole stack needs to be "assembled" before tests can be executed, including backends (database, email MTA). Should I even try to do this automatically? Jenkins builds everything (but does not deploy it automatically).
Here are my thoughts: Since each of the components by itself is not "complete", I'm thinking there is no point placing the tests in any of the projects. Instead I'm considering adding a component MyAppIntegrationTest
with nothing but tests in it, with Jersey Client and MyAppInterface
as dependencies. In order to test, I would build all components, deploy them on a test glassfish, then pass the URL to MyAppIntegrationTest
and let it run its tests.
Thanks for your thoughts!
I've no direct Java EE 6 experience.
However, as a point of reference, in Eclipse plug-in development, it is quite common to have separate projects / plug-ins / bundles for (integration) testing.
Thus, using a separate MyAppIntegrationTest
component to take care of the integration testing makes perfect sense to me.
精彩评论