Automatically run unit-tests when saving in Eclipse

Following on from Automatically run unit-tests when compiling in Visual Studio 2008, I was delighted to discover that the Eclipse alternative is even better.

In Eclipse, simply install a plugin called Infinitest, from the official download site. Also, ensure ProjectBuild automatically is checked.

Now, whenever you save, it will run the relevant tests. This is much quicker than having to run all the tests (although you should do that every now and then to be safe!!). Secondly, test errors appear as build errors, and you get a nice red or green result in the status bar, so the UI is perfect. Finally, Eclipse just seems to run tests vastly quicker than VS 2008.


Eclipse Cheatsheet

Having got used to a lot of keyboard shortcuts in Visual Studio, here’s a cheat-sheet of their Eclipse equivalents.

Eclipse shortcut Command Visual Studio shortcut
Ctrl+I Correct indentation Ctrl+K
Ctrl+B Build All (note Eclipse has a build-on-save option) Ctrl+Shift+B