debug java application with TestNG and maven -


i'm creating applicattion that's work tdd(test-driven-development). create projects test before development , doubt if can debug coding test when execute maven (mvn clean package). cos testing running maven. development environment is:

  • eclipse juno
  • maven 3.0.5
  • java 1.6

ok found solution if sb needs,

by default, maven runs tests in separate ("forked") process. can use maven.surefire.debug property debug forked tests remotely, this:

mvn -dmaven.surefire.debug test 

the tests automatically pause , await remote debugger on port 5005. can attach running tests using eclipse. can setup "remote java application" launch configuration via menu command "run" > "open debug dialog..."

if need configure different port, may pass more detailed value. example, command below use port 8000 instead of port 5005.

mvn -dmaven.surefire.debug="-xdebug -xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -xnoagent -djava.compiler=none" test 

link maven page


Comments