Eclipse 中 JUnit 测试的调试断点不起作用
我正在尝试在 Eclipse 中调试 junit 测试,但我的断点没有触发(除非它们位于第一行或第二行)。
我尝试删除并重新创建工作区中的所有断点,清理项目,创建新的调试配置,并单独运行测试方法并作为测试类的一部分与其他方法一起运行。但一切都无济于事:-(
public void testLoadPatientsAndConvertToBeans() throws IOException, CDataGridException {
File file = fileutil.getFileFromPrefsOrPrompt(basefileDef);
CDataBuilder builder = new CDataDelimitedFileBuilder(file,
CDataDelimitedFileBuilder.DelimiterSettings.WINDOWS_CSV,
basefileDef);
// breakpoints placed on lines from here on do not fire
CDataCacheContainer container =
cacheIO.construct(
new CDataNarrower(
cacheIO.construct(builder)
).setConvertMissing(true));
assertEquals(13548, container.size());
cacheIO.export(container, patients);
Collection<Patient> pBeans = patients.getBeans();
assertEquals(container.size(), pBeans.size());
Patient patient = pBeans.iterator().next();
Map props = patient.getPropertyMap();
System.out.println(props);
}
I am trying to debug a junit test in eclipse but my breakpoints are not firing (unless they are on the first or second line).
I've tried deleting and recreating all breakpoints in the workspace, cleaning the project, creating a new debug configuration, and running the test method individually and as part of a test class with other methods. But all to no avail :-(
public void testLoadPatientsAndConvertToBeans() throws IOException, CDataGridException {
File file = fileutil.getFileFromPrefsOrPrompt(basefileDef);
CDataBuilder builder = new CDataDelimitedFileBuilder(file,
CDataDelimitedFileBuilder.DelimiterSettings.WINDOWS_CSV,
basefileDef);
// breakpoints placed on lines from here on do not fire
CDataCacheContainer container =
cacheIO.construct(
new CDataNarrower(
cacheIO.construct(builder)
).setConvertMissing(true));
assertEquals(13548, container.size());
cacheIO.export(container, patients);
Collection<Patient> pBeans = patients.getBeans();
assertEquals(container.size(), pBeans.size());
Patient patient = pBeans.iterator().next();
Map props = patient.getPropertyMap();
System.out.println(props);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用的是 Sun JDK 6 Update 14,则可能会出现这种情况。请参阅另一个 类似的问题。在这种情况下,可能的解决方案是使用 Sun JDK 6 Update 16。
This is likely if you are using Sun JDK 6 Update 14. See another similar SO question here. The likely resolution in such a case is to use Sun JDK 6 Update 16.
我的第一直觉是 Eclipse 中的缓存类与您的代码不同步。但是,鉴于您已尝试清理/重建项目,它应该已经修复了它。由于您可以在第一行/第二行放置断点,那么当您单步执行代码时会发生什么?代码是否与每个步骤一致?如果没有,则表明 eclipse 的类版本与您的源代码不同。如果它们相同,我会尝试下载较新的 Eclipse 副本(我假设您已经尝试重新启动 Eclipse),因为您可能发现了一个奇怪的错误(新版本可能已修复它或清理了一些过时的数据)。抱歉,我无法提供更多帮助。
My first intuition is that the cached class in eclipse is out of sync with your codes. However, given you have tried clean/rebuild your project, it should have fixed it. As you can put a breakpoint on the 1st/2nd line, what happens when you step through the codes? Does the code align with each steps? If not, it shows that the eclipse has a different version of class from your source codes. If they are the same, I would try to down a newer copy of eclipse (I assumed you have already tried restart your eclipse) since you may have discovered a strange bug (new version may have fixed it or clean some stale data). Sorry that I can't be any more helpful.