JUnit and Eclipse

Eclipse, for those of you who don't know, is an amazing platform for developing integrated tools, which comes with a Java IDE build on the platform. It's all Java, and it's the best IDE I've come across (though I can't say I've used MS Visual Studio).

JUnit is a very lightweight testing framework for doing unit testing in Java. The idea is that you can write a "thing" that will test a single method of a class, and then the JUnit framework will take care of running that "thing" (it's a method of a class that extends TestCase), handle any exceptions, failed assertions and whatever else, and give you a report about it. You can stack as many test cases together as you want, and create suites for regression testing large projects.

Eclipse + JUnit is very nice. I'd never used JUnit until I started working on JSPCF. I knew I needed some kind of regression testing, because the scope of the project would quickly overwhelm me. In comes Eclipse to save the day, not only with a very well-integrated JUnit plugin for testing within the IDE, but wizards and tutorials to get you going from scratch in no time. I went from writing the first method in JSPCF, realizing I needed some kind of regression testing to keep my sanity, found JUnit's web site, hit the Eclipse helps, and had my first test suite running (and finding a stupid logic error in my method) within 15 minutes, and that included indexing the Eclipse help.

I'm still riding the initial euphoria, so my perspective is undoubtedly skewed, but I can't say enough good things about JUnit. If only it were possible to use it on web apps.

Comments are closed.