users@glassfish.java.net

testing glassfish JEE application

From: <jmilkiewicz_at_gmail.com>
Date: Thu, 1 Sep 2011 17:06:06 +0200

Hi

After reading a few articles/blog entries on Java EE testing it seems
there are multiple options in this domain. Can anyone provide me a
high level overview of Java EE/Glassfish testing approaches? From
glassfish perspective i see 2 approaches:

- using glassfish-embedded-all as dependency and
EJBContainer.createEJBContainer(props)/org.glassfish.embeddable API in
Junit/TestNg Tests

- using embedded glassfish (for example through
maven-embedded-glassfish-plugin ) with fail-safe plugin to run tests

The first option allows you to start EJB containter directly from test
classes and test EJBs locally. Both test classes and EjbContainer are
run in the same JVM, so you can test local EJB with this approach.
These kind of tests are used for testing EJBs (EJB-based Webservices ?
) so these test could be categorized as integration tests.

In the second option a full glassfish is started manuall/by Maven in a separate
JVM and then application is deployed. To let your tests communicate with the
application a "standard remote mechanisms" : HTTP, Corba, SOAP are used.
These tests would be mostly end-to-end tests since to communicate with
application-under-test you would communicate with it via one of its
remote interface - just to mimic consumer of your application.

Can anyone confirm on my understanding of testing applications in glassfish ?

regards,

Jakub