Pages

Friday, March 2, 2012

Debugging Arquillian Integration Tests using Eclipse and Jboss

Debugging is an important aspect of development. This post is about setting a debug environment for arquillian integration test using eclipse and jboss. This is a bit different from normal unit tests debugging as the tests, in this case really runs inside the container so we should actually set up the remote debugging.


 
1) For debugging we need to first have the arquillian test run in the remote container and not in the managed one.In order to do that you have to first import the following maven dependency.
         <dependency>
                    <groupId>org.jboss.as</groupId>
                     <artifactId>jboss-as-arquillian-container-remote</artifactId>
                     <version>7.1.0.Alpha1-SNAPSHOT</version>
            </dependency>
Note : Since we are going to debug on remote container, kindly remove the jboss-as-arquillian-container-managed  dependency in pom.xml if exists.

2) Set the following as you java opts in your Jboss and start the server. This will start your jboss in debug mode.

set JAVA_OPTS=%JAVA_OPTS% -Xdebug -Xrunjdwp:transport=dt_socket,address=8585,server=y,suspend=n

3) Set the remote debugging option in eclipse, following the quick steps given below

         Select the Debug > Debug Configurations... menu from the main menu bar      
         Double Click on the Remote Java Application tree node available in left side of the popup  window and create new debug config

         Configure the name of the debug configuration

         Configure the project which we need to debug

         Configure the host name (where the jboss server is actually running) 

         Configure the port number (debug port number)

          Click on Apply Button


 










Click Debug
 
 
 
 
 
 
 
 
 
 
 
4)Open your test. Add break points and run using "Debug as.."
 
Credits:RajendraPrasad Kancharla

No comments:

Post a Comment