You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by "Hoehmann, Andreas" <an...@siemens.com> on 2008/01/24 20:25:06 UTC

Debugging Plugin

Hello folks,

i try to understand the internals of the surfire-plugins (api, report,
testng-provider). 
Why? I want fix some testng-bugs ;) First i try to fix the bug "ignoring
the defined
testng-suite-name and use allways 'TestSuite'" ... i don't undertstand
where the suitefiles
parsed (i guess anywhere in the TestNGXmlTestSuite?!) ... 

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

Regards
andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Debugging Plugin

Posted by Dan Fabulich <da...@fabulich.com>.
Thanks for posting that, Benjamin.  I've filed SUREFIRE-436 that we should 
update the site documentation to include a more explicit debugging 
tutorial (at least for debugging forked tests).

You both may note that I've posted a long rant about the bug Andreas is 
interested in (SUREFIRE-433) on the surefire-dev mailing list.  Do people 
read surefire-dev?  [*I* do, but ... ;-)]

Does Surefire need its own mailing lists, separate from the regular 
maven-dev and maven-users list?  Should we be discussing Surefire stuff on 
the general -dev list?

-Dan


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Debugging Plugin

Posted by Benjamin Bentmann <be...@udo.edu>.
> 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: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org