Debugging maven 'test' goal with Intellij IDEA
I'm having issues debugging a Maven 'test' goal with Intellij IDEA. The debugging thread doesn't stop at breakpoints. Is there any science involved in configuring debug options? (I am using TestNG for tests)
请先登录再写评论。
Hi,
Was facing same issue.... you need to setup your pom for surefire plugin and like this
<debugForkedProcess>true</debugForkedProcess>
after this maven (surefire plugins) suspends the test execution till a debugger attaches iteself to the port 5005.
from a separate process attach to this port and you will hit your breakpoints....
try playing around with these options.
Thanx a lot Asif, you're the first guy who replied to my question. I'll inshaAllah work on the tips you've given and will post back the results soon.
Usually, if you debug, you debug one test at a time. Be it one method
or a class, if you create an Idea configuration to run your TestNG test
(right click on test method or class), then debuging just works.
That's very simple. I keep the maven test goal to launch the whole test
suite, which I don't want to debug!
If you want to debug maven test, then you have to go for a Remote
debug, as Asif indicated.
/nodje
On 2009-11-14 01:11:32 +0800, Humayun S M <no_reply@jetbrains.com> said:
You probably don't need help with this anymore, but for posterirty this is what I've done:
I don't need this:
<debugForkedProcess>true</debugForkedProcess>
Instead, I only need to add:
<configuration>
<forkedMode>never</forkedMode>
</configuration>
And this is the fun (read: irritating to figure out) part. Click on the Maven Plugins in the maven facet button (left vertical toolbar) -- NOT on the maven goals. Right click on the failsafe:verify, click create. Copy the command, exit without creating that run configuration. Right click failsafe:integration-test, click create, paste the verify command after the integration-test command, leaving a space. Save this run configuration. Now you can click Debug on this configuration and it should work. Works for me with Arquillian, which is a real pain-in-the-F&*@ing-@ss to set up.
Hope my pain will help others.