简体   繁体   中英

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?

您应该使用Debug as > JUnit test开始单元Debug as > JUnit test

如果断点出现反斜杠,则必须转到调试透视图(窗口→打开透视图),然后在“断点”窗口中取消选中“跳过所有断点”按钮(带有反斜杠的圆圈)

Plese use

-XX:+UseParallelGC

in debug configuration > VM arguments section

我今天遇到了这个问题而且对我来说原因是纯粹的愚蠢 - 如果单元测试首先输出一些东西到控制台然后抛出一个异常,在到达断点之前,你没有在eclipse的调试视角中看到异常,因为它在JUnit视图中打印,但输出在从该视图切换到Console输出之前。

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM