Help: Groovy debugging -- breakpoints ignored

Using 8.1 under Mac OS X.

I created an Idea project from our maven source structure using mvn idea:idea.

We have a bunch of modules and each has a src folder and a test folder and in the latter we have both Java test classes and possibly Groovy test classes.

I can open a Java (Junit) test class in the Idea editor and then run or debug that test class from within the IDE -- the console shows any output and I can set breakpoints and the debugger stops there.

At first I could not run the Groovy test classes from the IDE (run option was not enabled) but then I found out I had to go to the module properties config and identify the contents of the groovy folder inside test as "test" classes.

This enabled the run item for the groovy classes and I seemed to be able to run them. I see the console come up and I get told that all tests pass.

BUT, I think that they are not running at all. I always see a report that all tests pass. I changed the logic of one of my asserts so that a test method should fail but instead Idea still says that the test passes.

I added some groovy println statements into my test methods but the console never shows any output from them.

In the editor, I tried to set a breakpoint and execute the debug option for the test class and the breakpoint is never reached.

So it looks like the debugger and/or the groovy runtime is not being invoked properly from inside Idea.

I have groovy 1.6.1 installed in /usr/local.

Maybe I am missing some bit of groovy setup?

Thanks for any help.

Jim

16 comments
Comment actions Permalink

Please use the latest 8.1.1 EAP
(http://www.jetbrains.net/confluence/display/IDEADEV/Diana+EAP). The
problem should be fixed there.

0
Comment actions Permalink

Thanks for the tip.

But this did not help me -- same problem.

BUT, I did play with Idea some more after I posted the first message, and it seems like if I change the source for the Groovy Test file, or set a breakpoint there, AND then I compile the class from Idea once or twice, and then I run/debug the class, the changes I made are seen by Idea and I get the expected behavior. Usually 1 compile and run is not enough -- seems like 2 are occasionally required.

This same re-compile magic works for the Diana EAP (#9805) but this EAP is no better about allowing me to make changes to the class with the editor and then having those changes perceived right away during a run or debug action. Unless, I should always compile first?

I did not do a mvn idea:idea after trying out the EAP -- I left whatever was there from my past Idea usage.

Maybe there is a newer EAP coming?

Jim

0
Comment actions Permalink
  • In IntelliJ GUI enter ctrl-alt-s.
  • Under IDE Settings in the left panel, select Debugger/Groovy
  • In the right panel uncheck 'Do not step into Groovy classes'
  • Click OK to save


Now try debugging with breakpoints in Groovy classes and let us know whether this helps (see attached screenshot).



Attachment(s):
Screenshot-Settings.png
0
Comment actions Permalink

No change to my observed behavior after unchecking the Groovy debugger option.

My experience is the same:

  • Make code change to groovy class -- extends GroovyTestCase
  • Run or debug and the code change is not perceived -- Idea returns immediately claiming all tests pass
  • Now compile the class manually from Idea and run or debug again
  • Still the code change is not seen and no breakpoints or changed results are observed -- all tests pass
  • Now compile the class manually a second time and then run or debug
  • Finally, the changed code is seen to run -- for example, breakpoints are reached and new println statements execute


I need to compile and then run twice for each change I make to my source class.

This behavior is the same for 8.1 and the Diana EAP I downloaded Friday. No change after changing the option as directed.

Very strange.

0
Comment actions Permalink

I did some more checking and it seems that now:

  • code change followed by compile followed by run/debug does NOT work -- all tests always pass in my Groovy test class no matter what asserts I make, even erroneous ones


BUT

  • code change followed by run/debug (all tests pass -- not correct behavior) followed by compile and then followed by another run/debug works -- I see expected behavior in console and breakpoints are honored if set


Hope this helps with the troubleshooting.

Jim

0
Comment actions Permalink

Please add the following lines to bin/log.xml just before the 'root' tag:

<category name="#com.intellij.compiler">
<priority value="DEBUG"></priority>
<appender-ref ref="CONSOLE-ALL"></appender-ref>
</category>
<category name="org.jetbrains.plugins.groovy.compiler">
<priority value="DEBUG"></priority>
<appender-ref ref="CONSOLE-ALL"></appender-ref>
</category>




After that, please restart IDEA and repeat the compile/run actions that  don't work for you. Finally, go to the <system>/logs and send the logs here.

0
Comment actions Permalink

Sorry -- I don't see the lines that I am supposed to add.

I did find log.xml in the bin folder.

0
Comment actions Permalink

Oops. Fixed, now you should see them.

0
Comment actions Permalink

OK, here is the log file after doing the log changes.

At the very end of the log (lines 1149 to 1235), you can see a log of a successful compile and run of a Groovy test class -- the test really runs.

Earlier in the log (lines 990 to 1148), you can see what is shown when the groovy class fails to really execute. This corresponds to me making a change to the groovy class, clicking compile in the IDE and then trying to run. The test class appears to run but does not. Then if I compile again (log beginning at line 1149) and then run, I am successful.

The first compile and run is somehow ignored or processed incorrectly.

The Idea project is derived from mvn idea:idea on a larger system that we have under svn and for which we use maven to automate continuous builds and tests.

I was trying to learn enough Idea to help me create a new Groovy test case and then run the test from inside of Idea.

Trying to do this is what lead to this discussion.

Please ask if there are any questions.

Jim



Attachment(s):
idea.log
0
Comment actions Permalink

Thank you for the log, it's indeed very interesting. I even sometimes
can reproduce the problem, but very-very rarely so I can't trace it.
Which actions do you use for compilation/running (compile file, make,
rebuild, run from context, rerun, etc.)? Do you make changes in source
files or just recompile them?

0
Comment actions Permalink

Thanks for checking and somewhat confirming my report.

I have prepared a sequence of operational screen shots that document my Idea usage workflow that make the problem 100% reproducible for me.

Maybe they will help you reproduce the problem more readily.

Thanks for the interest.

Still using the Diana EAP (9805)  I downloaded last week/



Attachment(s):
Idea Problems with Groovy Test Classes.pdf
0
Comment actions Permalink

Thank you for you patience. There was additional logging added in the
just released #9821, please take it and repeat the steps to reproduce.
Please also delete the logs just before this and restart IDEA, so that
logs don't contain excessive information.

0
Comment actions Permalink

I just wanted to add some input to this issue as I am also having the same problems - groovy test cases ignored, unable to step into groovy code with breakpoints, and print statements in groovy code not displaying in run console.  I am using 8.1.3 on WinXP with Groovy 1.6.2.  I have found that it seems to be a project specific issue.  If I create a new project and add a groovy class I am able to see output and debug.  I have tried rebuilding the idea project files using maven plugin for the project that I am having problems with but that did not seem to help.  Any ideas as to what would cause this behavior on a project level?

Followup - I opened the offending project in 7.0.5 and was able to debug the groovy class that does not work in 8.1.3.  When I opened the project in 7.0.5 I had it rebuild the project from the aggregate pom file (this is an aggregate project with multiple modules in it).  Hope this information helps solve this problem in some way.

0
Comment actions Permalink

Have you tried rebuilding project from within IntelliJ IDEA and running
tests right after that?

0
Comment actions Permalink

I had not.  So I ran a maven clean on all modules first just to have a clean slate.  Then I rebuilt the project from Intellij Build menu and was able to debug in the groovy class.

0
Comment actions Permalink

i have exactly the same problem (under 8.1.3). weird thing is that i never faced this problem before, but i do not know when i used the idea groovy test runner the last time (but it was definitely before 8.1.3).

in 8.1.3 i currently can workaround this issue by always executing compiling the test case after each change (Shift+Ctrl+F9).

even worse in latest milestone of idea 9 (10781) even rebuilding does not work. to make it working i have to run 'maven clean test'. there seems to be something wrong with refreshing groovy test cases (rebuilding them).

to me it is a major issue (i created an bug ticket for that http://youtrack.jetbrains.net/issue/IDEA-25063).

0

Please sign in to leave a comment.