开发者

JUnit won't stop at breakpoints in Eclipse (using JDK 1.6.0.20)

my breakpoints in Eclipse won't stop the execution of a JUnit test. It doesn't matter where I set the breakpoint in the JUnit method, it simply won't stop the code from flowing. Placing it in a class called in the JUnit test won't work either.

I am using the 开发者_开发知识库JDK in the version of 1.6.0.20, so I guess I'm not affected by the bug in version 1.6.0.14.

Do you know any hints concerning this matter?


You should start your unit-tests with Debug as > JUnit test


If your break points appear with a back slash across, you have to go to the debug perspective (Window → Open perspective) and in the ‘Breakpoints’ window, unselect the ‘Skip all break points’ button (circle with backslash across)


Plese use

-XX:+UseParallelGC

in debug configuration > VM arguments section


I've had this problem today and for me the reason was pure stupidity – if the unit test outputs something to the console at first and throws an exception afterwards, both before reaching the breakpoint, you do not see the exception in eclipse's debug perspective because it gets printed in the JUnit view, but the output before switched away from that view to the Console output.


There's likely an error in your test which is preventing JUnit from getting to the thing you're trying to test. JUnit doesn't like to show these errors. Try removing lines from your unit tests until they start to work, or put breakpoints inside the methods your unit test is calling.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜