Is it possible to run incremental/automated JUnit testing in Eclipse?

烂漫一生 提交于 2020-01-20 02:43:45

问题


Eclipse support incremental compiling. If I save a source file then it will compile the modified files.

Is it possible after such incremental compile also to run the JUnit tests of the same package and show the fail in the error view. Then I can see the JUnit test failing and compiling errors in the same view without extra action. Are there any plugins that can do it?


回答1:


You have to look at these plugins:

  • JUnit Max: Not free, developed by Kent Benk (one of the men behind the TDD practice);
  • MoreUnit: Free, but essentially dedicated to help you write the tests;
  • Infinitest: Now free, this plugin is dedicated to run the tests related to the files you have just modified.

So regarding your needs, I suggest that you install MoreUnit and Infinitest plugins.




回答2:


Use ExternalToolBuilder.

It can be triggered by source modify.

There’s Eclipse customized feature(integrate external tool builder) which may meet your need. But it needs extra effort to write the scripts I never used. Automatic test cases is not a convenient way, at least single click to see green bar in Eclipse is enough for me:)




回答3:


You can run all tests in a project using Alt+Shift+X,T. I think that making it any more automated than this could take a serious performance toll. Incremental compilation is compiling at most 1 file at a time, but you're talking about running potentially hundreds of tests.



来源:https://stackoverflow.com/questions/4842042/is-it-possible-to-run-incremental-automated-junit-testing-in-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!