Infinitest

The Infinitest Eclipse plug-in looks for unit tests and have them run as soon as changes are detected. Just as modern IDEs have provided automatic compilation for ages this can now also be provided for unit testing.

The test outcome shows up as a green or red bar in the bottom of the Eclipse application window. The plugin also gives more feedback. In case of failing test the failing line of code in the unit test shows up with a “problem” icon just as a compilation error would look like. Doing mouse-over on the problem icon you will get the failing assert message. This feature I have noticed in recent versions of Eclipse so try to update to the latest Eclipse if you don’t see this happen.

The problem indicator is quite powerful and allows a higher level of TDD. When doing pure TDD you write a failing test first. This would make Infinitest mark your assert statement as problematic until you save a working implementation of your tested code. This allows a very focused write failing test / write implementation-loop.

Infinitest operates independently from the JUnit view in Eclipse. As Infinitest is activated as soon as source code is saved while JUnit is run when initiated by the developer the state shown by either system is often out of sync. I have also experienced that the Infinitest fails to “re-test” but then a project clean brings it back on track. Even if there are quirks I think Infinitest is useful for my daily work and it really promotes TDD.

The plug-in is available on update site http://infinitest.github.com/ and if you are using SpringSource Tool Suite (STS) the plug-in is also available in STS’s  extension list.

This Post Has 3 Comments

  1. This is so useful! I’ve often wondered have to get the unit test feedback loop to work effectively and, of course, this is the way to go!

  2. Hello, I am using Eclipse 3.6 and I have JUnit test cases which are executed perfectly via the Infinitest plugin whenever I change the code. Now what I packaged all those test cases in a jar and included it in the project, they were not picked up by Inifinitest. Executing the jar as Junit works perfectly fine by Infinitest is not able to index these TCs in jar.

    Is this a known limitation? Any ideas to work around this?

    1. Infinitest is activated when source code in the IDE is changed and saved. That doesn’t happen for jars you include, so Infinitest won’t care about them.

Leave a Reply

Close Menu