How do I configure Eclipse to run your tests autom

2019-01-23 11:56发布

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?

4条回答
啃猪蹄的小仙女
2楼-- · 2019-01-23 12:12

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.

查看更多
别忘想泡老子
3楼-- · 2019-01-23 12:17

http://www.junitloop.org/index.php/JUnitLoop is another one like this (haven't tried it yet myself)

查看更多
欢心
4楼-- · 2019-01-23 12:26

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.

查看更多
Lonely孤独者°
5楼-- · 2019-01-23 12:36

You could try CT-Eclipse, a continuous testing plugin for Eclipse.

From the plugin page:

With CT-Eclipse enabled, as you edit your code, Eclipse runs your tests quietly in the background, and notifies you if any of them fail or cause errors.

查看更多
登录 后发表回答