在jUnit测试用例中如何打破调试器? [英] How to break into debugger within a jUnit test case?

查看:151
本文介绍了在jUnit测试用例中如何打破调试器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在大型java项目中调试单元测试。我需要运行'ant test ...'来启动测试套件。所以我很难从IDE启动它。调用C#中的Debugger.Break()函数可以调用调试器来调用调试器吗?

解决方案

p>如果我正确地理解你的问题,可以通过设置这两个jvm参数来使用java的远程调试:

  -Xdebug  - Xrunjdwp:transport = dt_socket,server = y,suspend = y,address = 1044 

蚂蚁任务,您可以将这些参数添加到您的ant < java> 任务中。有关详细信息,请参阅蚂蚁中的java调试选项/ a>链接。


I'm debugging a unit test in a large java project. I need to run 'ant test ...' to launch the test suite. So it's difficult for me to launch it from the IDE. Is it possible to call some function like Debugger.Break() in C# to break into the debugger if it's attached to any debugger?

解决方案

If I am understanding your question correctly, you can use java's remote debugging by setting these 2 jvm parameters:

-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=1044

And for debugging your ant task you can add the these parameters in your ant <java> task. For details you may follow java debug options in ant link.

这篇关于在jUnit测试用例中如何打破调试器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆