Testing EJB3
Vital to any development is the ability to test that application. Most frameworks have their very own testing suites, EJB3 is no exception and their are a variety of testing apparatuses. We will examine testing with JBoss Embedded, EJB3Unit and mocking with Easy Mock and JMocks.
Testing with EJB3 produces new issues that most developers have not seen locally. For one thing, their are generally no DAO's when dealing with Java Persistence API. Because of this it makes whats normally called integration or container testing more valuable even at the unit level, since no other piece of the application will be testing them directly.
In this session we discuss two of the major ways to perform integration testing. The first is through a light container called EJB3Unit. This is an easy to set up testing framework that uses HSQL as the underlying database. However, EJB3Unit is more of a cross between unit and integration testing, for full on Integration testing we will use JBoss Embedded to get a richer feel.
In addition, when using the integration frameworks is not as necessary, or when you need to add some mock testing to your EJB3Unit tests we will discuss two mock frameworks. The first are EasyMocks, the second is a newer framework that allows a bit more versatility called JMockIt.
By the end of this you should be ready to go and test your EJBs thoroughly.
About Joseph Nusairat
Joseph Faisal Nusairat, author of “Beginning JBoss Seam” and co-author “Beginning Groovy & Grails”, is a Java developer who has been working full time in the Columbus Ohio area since 1998, primarily focused on Java development. His career has taken him into a variety of Fortune 500 industries including military applications, data centers, banking, internet security, pharmaceuticals, and insurance. Joseph is particularly fond of open source projects and tries to use as much open source software as possible when working with clients. Joseph is a graduate of Ohio University with dual degrees in Computer Science and Microbiology with a minor in Chemistry. Currently, Joseph works as a Senior Partner at Integrallis Software (www.integrallis.com).
More About Joseph »