Debugging tests cases with maven : java remote debugging

The project testcases can be debugged in maven by the java remote dubugging options.

Just add the debugging options along with the mvn test command.

$ mvn test

now becomes:

mvn -Dmaven.surefire.debug="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -Xnoagent -Djava.compiler=NONE" test

The ‘suspend=y’ flag will pause the execution until you have attached a debug port for listening.
Thats it, just configure ecilipse debug configurations to listen to the port and set few breakpoints in your testcase code.
We are done!!
 

Leave a Reply

Your email address will not be published. Required fields are marked *