如何配置 Eclipse 自动运行测试?
我读了这篇文章:配置您的 IDE 以自动运行测试 http://eclipse.dzone.com/videos/configure-your-ide -run-your
配置 Eclipse IDE 以在每次保存文件时运行 Ant 目标非常容易。 我的项目-> 右键:属性-> 建设者-> 新-> Ant Builder
问题是构建器必须在每次保存时重建 jar,这非常长。 JUnit 测试使用 jar 中的 .classes 运行。
我们已经有了 JUnit 配置(EclipseIde .launch 文件,其中包含运行测试的整个类路径)。 我希望我可以创建一个包含这些 JUnit 启动文件的构建器。 这将有利于针对 Eclipse .classes 运行测试(比重建 jar 更快)。 测试结果也显示在 JUnit 视图中。
有人设法做到这一点吗?
I read this article: Configure your IDE to run your tests automatically
http://eclipse.dzone.com/videos/configure-your-ide-run-your
It's pretty easy to configure Eclipse IDE to run an Ant target every time a file is saved.
MyProject -> Right-click : Properties -> Builders -> New -> Ant Builder
The problem is that the builder has to rebuild the jar on every save, which is very long. The JUnit tests run using the .classes in the jar.
We already have JUnit configurations (EclipseIde .launch files which contains the whole classpath to run the tests). I wish I could create a builder that wraps those JUnit launch files. This would have the benefit of running the tests against Eclipse .classes (faster than rebuilding the jar). Also the test results are displayed in the JUnit view.
Has anybody manage to do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我最近开始使用 Infinitest ,它似乎以某种方式“知道”代码的哪些部分影响哪些测试用例。 因此,当您更改某些代码时,它会自动重新运行可能会中断的测试。 如果测试失败,它会在失败的地方标记一个错误,就像 Eclipse 标记一个编码错误(例如调用不存在的方法或其他错误)一样。 这一切都在后台发生,您无需执行任何操作。
I recently started using Infinitest and it seems to somehow "know" which parts of the code affect which test cases. So when you change some code, it automatically re-runs the tests which are likely to break. If the test fails, it marks an error at the spot where it failed, the same way Eclipse would mark a coding error like calling a non-existent method or whatever. And it all happens in the background without you having to do anything.
您可以尝试 CT-Eclipse,这是一个 Eclipse 的持续测试插件。
从插件页面:
You could try CT-Eclipse, a continuous testing plugin for Eclipse.
From the plugin page:
您可以使用 JUnit Max 它是一个 Eclipse 插件,它将运行您的所有测试你节省的时间。 但它不会中断您的工作流程。 结果显示在 Eclipse 的左角,您可以随时返回到上次成功的测试运行。 该插件首先运行最有可能失败的测试,以便您尽快获得上次保存的响应。
You can use JUnit Max it is an eclipse plug in that will run all you tests every time you save. But it will do it without interrupting your work flow. The results are shown in the left corner of Eclipse and you can always go back to the last successful testrun. The plugin runs the tests that are most likely to fail first so that you get a response for your last saving as fast as possible.
http://www.junitloop.org/index.php/JUnitLoop 是另一个类似的这个(我自己还没试过)
http://www.junitloop.org/index.php/JUnitLoop is another one like this (haven't tried it yet myself)