Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. From the command line, invoke mvn test goal but specify the flag to enable remote debugging
    mvn -Dmaven.surefire.debug test
    
  2. The execution will stop with a message like:
    --------------------------------
    T E S T S
    --------------------------------
    Listening for transport dt_socket at address: 5005


  3. Configure a remote debug job in Eclipse.  There are probably many ways to do this, but I opened Debug Configurations, selected "Remove Remote Java Applications", filled in Name: "remote debug on 5005", Host: localhost, Port: 5005.  This step only needs to be done once.
  4. Set breakpoints of interest, and launch remote debugger created in step 3.
  5. To just run a single test class instead of the whole works, start maven using the -Dtest param.  For example,to only run tests defined in test Class DmaapResourceTest.java:
    mvn -Dtest=DmaapResourceTest -Dmaven.surefire.debug test


  6. I was running on an Ubuntu 16.04 VM instantiated on Oracle VM VirtualBox Manager running on Windows 10, and did experience a problem stepping through some functions.  In Eclipse, I disabled Preferences->Java→"Show method result after a step operation (if supported by the VM; may be slow)" which I found in an unrated answer in Ref 3  above.

...