Testing JEE6 applications with Arquillian

Creating automated tests for JEE applications has always been a challenge, once it requires a running container to provide all the services the application needs to work properly and that the tests need to be executed.

The Arquillian framework was born to make this job a lot easier to be executed. Your main goal is to provide a powerful test platform responsible of taking care of many aspects while testing JEE applications, such as start a container, deploy an application in the container, run the tests and stop the container. It also allows that your test classes can be enriched with annotations like @Inject, @EJB and @Resource, among others. This way, one can easily create real integration tests. Arquillian also allows users to choose either JUnit or TestNG to create and execute the tests, besides allowing the same test cases to be executed in different containers, such as JBoss, Glassfish and Tomcat.

This post’s goal is not to discuss the benefits in writing automated tests -TDD or not- but, instead, focus on how to use Arquillian through a practical example.

Continue reading “Testing JEE6 applications with Arquillian”