My breakpoints aren't being hit when I try to debug a Junit test in Eclipse. Is there some trick I am missing? Does anyone have any ideas?
Okay it is resolved. The Junit test was being injected into a jboss server running in the Eclipse IDE. The Junit test is injected into the jboss server through the use of Arquillian. The reason the Junit test was skipping the breakpoints was because the jboss server also had to be started in debug mode. I restarted jboss in debug mode and ran the junit test again. This time, the break points are hit.
Related
I'm using intelij as IDE in application tapesrty5 and for server i'm using jetty runner as plugin for intelij
the problem is when i'm trying to run as debug mode the break point never been trigged
Breakpoint created but never been triggered !
I'm hitting a weird issue were my unit tests fail when running mvn install but they pass when running in IntelliJ.
I've looked at posts online about debugging maven, but I don't want to debug maven itself, or a maven plugin. I want to debug my unit tests when they have been called by maven. More specifically, I want to debug my code but using the Junit tests as an entry point for the debugging via a breakpoint.
Hope that makes sense.
My issue is relating to using introspection to look at some classes the application is importing from another project. This succeeds when the project is running or running in debug mode, but fails when maven runs the tests as a part of an install. i.e. the code doesn't find the classes in the other project when running under maven...
As this application uses multiple maven projects that all need to be installed, I've had to move my unit tests out into another project just so that the installs don't fail and I can carry on development.
However, for obvious reasons I would like to put my unit tests in each individual project, so am very keen to debug this and find out what is failing.
My project is called infinite-state-machine and can be found here - https://github.com/museadmin/infinite-state-machine
The unit tests are currently in their own project here - https://github.com/museadmin/infinite-state-machine-test
If anyone can advise me how to run maven in debug mode and attach IntelliJ to it so that I can set a breakpoint in my failing unit tests I will be forever in their debt :)
Thanks in advance for any help.
Brad
I have created run configuration in Maven Projects for
mvn -Dit.test=PredictionWorkflowTest verify
which looks like here
and then set breakpoint inside PredictionWorkflowTest. Unfortunately, when I right click this configuration and select to debug it, tests passes as if no breakpoint were set.
How to make breakpoints working?
If I run test by clicking class itself, then breakpoints trigger, but integration conditions don't me (servers not starting).
Step 1: Add debug to maven run configuration
You are probably using Maven Failsafe Plugin to run the tests as explained in their documentation
If that's the case you need to add -Dmaven.failsafe.debug (documentation here) to your maven configuration so it becomes
mvn -Dit.test=PredictionWorkflowTest verify -Dmaven.failsafe.debug
When you run this maven command, the debugger will be listening at port 5005 by default
Step 2: Configure remote debugger in IntelliJ
Now in IntelliJ you need to configure a remote debugger configuration on localhost and port 5005
Step 3: Debug your app
Finally, run the maven command. Just before testing it will stop and wait for the debugger to start running the tests. The following message will be displayed in the terminal
Listening for transport dt_socket at address: 5005
Then start remote debugger configured in step 2. This should allow you to debug your app on integration tests break-points.
I'm running a Vaadin web app using the TomEE Maven plugin. When attempting to run debug in IntelliJ, it skips all breakpoints.
From what research I've read, it points to the debugger not attaching to the TomEE plugin.
Is there a way to do this without having to configure a standalone server? Ideally for development, I want to keep the dev setup simple and packaged within the pom.
if you run
mvn tomee:debug
then in intellij you configure a remote server on port 5005 and when the lisne "Listen ...5005..." is in the logs you connect/run this debug configuraton.
Then you debug in the server.
When I'm running the maven tests from my IntelliJ environment i can see all the application setup logs. I'm working with logback.
But when I'm running same maven tests on jenkins, there is no output for application logs.
Thus I have some tests that fails on linux and i have no idea why.
How can I make the logs be printed when i'm running:
mvn clean -DskipTests=false test