Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In IntelliJ, how do i debug a maven test goal?

Using intellij and maven pom files, how do i debug tests run inside the maven test goal?

When i run them directly in the code, it complains something about profiles missing, which i've ticked inside intellij's Maven Projects.

like image 428
JavaRocky Avatar asked Sep 24 '10 06:09

JavaRocky


People also ask

How do I debug test cases in IntelliJ?

Debug failed tests If you don't know why a test fails, you can debug it. In the editor, click the gutter on the line where you want to set a breakpoint. There are different types of breakpoints that you can use depending on where you want to suspend the program. For more information, refer to Breakpoints.

What is Maven debug command?

Just enter a command like this - >mvn -Dtest=TestClassName#methodname -Dmaven.surefire.debug test. It will start listening to 5005 port. Now just create a remote debugging in Eclipse through Debug Configurations for localhost(any host) and port 5005.


1 Answers

http://maven.apache.org/plugins/maven-surefire-plugin/examples/debugging.html

  • When surefire plugin version < 2.14: use -DforkMode=never
  • When surefire plugin version >= 2.14: use -DforkCount=0

In IDEA, open your run/debug configuration, in Runner tab, add fork options -DforkCount=0

enter image description here

like image 134
Hover Ruan Avatar answered Sep 23 '22 17:09

Hover Ruan