简体   繁体   English

调试更改结果Java Eclipse

[英]debugging changes result Java Eclipse

I'm wondering something about debugging and what it means. 我想知道有关调试及其含义的信息。

Currently developping a program that watches a directory and when something changes in the directory, it runs all the tests that it can find in the same directory. 当前正在开发一个监视目录的程序,当目录发生更改时,它将运行可以在同一目录中找到的所有测试。

So, I test what happens if you change the tests? 那么,我测试如果更改测试会怎样? I find that when I have 20 tests that should fail, and I change one of them to succeed, the program finds and runs all the tests and reports 20 failed tests. 我发现当我有20项应该失败的测试时,我将其中一项更改为成功,该程序将找到并运行所有测试,并报告20项失败的测试。 It doesn't use the new test, which is slightly odd. 它不使用新的测试,这有点奇怪。

Now, when I go through the program with a debugger, it does detect the new test! 现在,当我使用调试器检查程序时,它确实会检测到新测试!

How come the results change when using a debugger? 使用调试器时结果如何变化? It is the default debugger of Eclipse. 它是Eclipse的默认调试器。 The program watches the directory using a WatchService and runs and collects the tests using JUnit. 该程序使用WatchService监视目录,并使用JUnit运行并收集测试。

I shall answer your question as I understand it. 据我了解,我将回答您的问题。
The debugger in eclipse is designed for making complex applications, like GUI's or apps like your own. eclipse中的调试器用于制作复杂的应用程序,例如GUI或您自己的应用程序。
The debugger allows you to change the code of a program in real time . 调试器允许您实时更改程序代码。 It is designed for you to be able to edit an application, and see what your doing with it, IE changing a window size, ETC. 它旨在让您能够编辑应用程序,并通过IE更改窗口大小ETC来查看对它的处理方法。
Each debugger run is a clean build. 每次调试器运行都是一个干净的版本。 Try cleaning the builds of your eclipse project, this may be creating the problem, as the compiler is logging the data and expecting you to input a certain answer. 尝试清理eclipse项目的构建,这可能是问题所在,因为编译器正在记录数据并期望您输入特定答案。

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

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