简体   繁体   English

IntelliUn IDEA中出现了JUnit测试版本

[英]JUnit test debuging hangs in IntelliJ IDEA

During debugging the test code it hangs on the initialization phase. 在调试测试代码期间,它会在初始化阶段挂起。 The latest message at the log is (before the debugging hangs): 日志中的最新消息是(在调试挂起之前):

2013-03-15 13:03:09:215 INFO [ : ] [main:ohdDialect] Using dialect: my.company.package.util.hibernate.HSQLDialect

Please consider the following factors which seems to impact the debugging: 请考虑以下影响调试的因素:

  • Test runs with @RunWith(SpringJUnit4ClassRunner.class) 使用@RunWith(SpringJUnit4ClassRunner.class)测试运行@RunWith(SpringJUnit4ClassRunner.class)
  • Test run on IntelliJ IDEA 12.0.4 在IntelliJ IDEA 12.0.4上进行测试
  • When tests run without debugging they works without any problems 当测试运行而不进行调试时,它们可以正常运行

What to do to debug the code? 如何调试代码?

Make sure you did not place a breakpoint on method signature instead of line of regular code. 确保没有在方法签名上放置断点而不是常规代码行。 You can recognize such breakpoint also by 4 black dots inside red circle. 您也可以通过红色圆圈内的4个黑点识别出这样的断点。 They slow down debugging dramatically. 它们大大减慢了调试速度。

Try to remove all breakpoints and restart your Debug. 尝试删除所有断点并重新启动Debug。 Press Command+Shift+F8, then Command+A and press Del. This if for Mac. 按Command + Shift + F8,然后按Command + A并按Del。这对于Mac。

It could easily be that you need to supply the test with more PermGen space. 很容易就是你需要为测试提供更多的PermGen空间。

Try using this in your configurations for that test: 尝试在该测试的配置中使用它:

-XX:MaxPermSize=300m 

If your tests aren't insanely huge (and they shouldn't be), this should be more than enough. 如果你的测试不是非常庞大(并且它们不应该),那应该是绰绰有余的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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