Why? I want fix some testng-bugs ;)

:-)

Pleas can anyone tell me : how can i debug a running surefire-plugin
(e.g. in Eclipse)

You can setup a "Remote Java Application" launch configuration via the menu
command "Run" > "Open Debug Dialog...". The "Project" could be one of the
Surefire modules, the "Connection Type" settings should match the debug
settings used to invoke Maven. Maven 2.0.8 comes with shell scripts named
"mvnDebug" that allow you to easily launch Maven for a debug session (watch
out for "-Xrunjdwp" in the start script to get a glimpse of the employed JVM
args to setup the connection). Additionally, you may want to add "Source
Lookup Path" entries to the Eclipse launch configuration such that you get a
source code view when Eclipse breaks.

Once the Eclipse launch configuration is properly setup, you can get a feel
of Maven's heart beat: Just run
 mvnDebug test
to start Maven for debugging of the test phase. The console output should
print something
 Preparing to Execute Maven in Debug Mode
 Listening for transport dt_socket at address: 8000
indicating that Maven is waiting for the debugger to attach, i.e. Maven's
JVM has been paused right now. Time to switch to Eclipse, set your
breakpoints (e.g. in the execute() method of the Surefire plugin) and run
the previously configured "Remote Java Application" launch configuration.
The Eclipse "Debug" window should now show the Maven JVM and come to a halt
at your breakpoint some seconds later.

If you enabled forking for the tests, you will need to setup another "Java
Remote Application" launch configuration to debug the SurefireBooter.
Additionally, add
 <debugForkedProcess>true</debugForkedProcess>
to your Surefire configuration [0]. The default port for the Surefire JVM is
5005 so be sure to setup the Eclipse launch configuration properly. Once
that's setup, debug Maven as above described and when it comes to forking
the Surefire JVM, switch back to Eclipse and start the second launch
configuration to get both processes ready for a nice debug session.

Hope that helps,


Benjamin Bentmann


[0] http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to