Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I configure Eclipse to run your tests automatically?

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?

like image 968
Boune Avatar asked Aug 07 '09 21:08

Boune


People also ask

Can JUnit be run automatically?

JUnit provides Test runners for running tests. JUnit tests can be run automatically and they check their own results and provide immediate feedback.

How do I change test runner in Eclipse?

All tests should be run with jUnit3, if i run a non-configured Test, it tries to use the default-TestRunner (jUnit4). So, i have to go into the run/debug configuration, change the TestRunner to "jUnit3" and run it again. On EVERY Test.


1 Answers

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.

like image 122
Tyler Avatar answered Nov 10 '22 23:11

Tyler