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”

Configuring a data source on JBoss 7

This post will describe the steps necessary to configure a JDBC DataSource in JBoss 7. MySQL database and JBoss 7.1.0-Final will be used as example.

Configuring MySQL JDBC driver module

The first big change on JBoss 7 compared to the previous versions is that the libraries to be deployed are no longer considered “libs”, in the sense that all the required work was to copy the .jar files to a specific folder and start using the services provided by that .jar. Any lib is now considered a JBoss module, like the server’s internal services, such as messaging. The following steps are required to configure the MySQL JDBC driver:
Continue reading “Configuring a data source on JBoss 7”