Maven unit tests (run by surefire plugin) can be debugged with eclipse. Firstly check you’re using surefire plugin version 2.16 or newer. Observe / add following in your pom.xml
maven-surefire-plugin 2.16
Ensure you’ve set some breakpoints to debug the faulty codes. Then on your run configuration, add -Dmaven.surefire.debug=true parameter:
When this run configuration is executed, maven will wait for you to attach the remote debugger instead of launching the tests:
Now open eclipse debug configuration, create a Remote Java Application config with your source code and set the port to 5005:
When the debugger attaches the unit test will proceed and when any breakpoints hit you can debug it like a normal java/eclipse application