views:

556

answers:

3

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?

+3  A: 

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.

Rich Seller
Does anyone know if CT-Eclipse can work in newer versions of Eclipse than 3.1 mentioned here: http://groups.csail.mit.edu/pag/continuoustesting/? The latest message posted to the mailing list (https://lists.csail.mit.edu/pipermail/continuous-testing-plugin-discuss/2009-April/000157.html) suggests moving to JUnit Max, which is not supported any more.
L.R.
+2  A: 

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.

Janusz
I think it's dead - http://www.junitmax.com/junitmax/subscribe.html
Jon
But it is still working :)
Janusz
+2  A: 

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.

MatrixFrog