|
|
AS OF 7/4/2008 8:32PM EST
|
February 15, 2006 —
Annotations and support for Java 5 are key new features of JUnit 4, and the first beta of the updated open-source unit test tool is now available for download.
Kent Beck, co-author of JUnit, said, “Our goal has always been to have a very simple, appealing tool to support testing for programmers. Programmers, generally speaking, figure their plates are full, so adding testing to that can be a challenging sell. So we’ve always tried to design JUnit so that it was the minimal barrier of entry to write tests. We’re using Java 5 annotation facilities to make test-writing easier. What we discovered along the way is that we were able to add some significant flexibility to the framework.”
The new version, which should be ready for release this summer, will include a smaller, more concise API that is more powerful and easier to use, Beck said.
Beck said that JUnit 4 also was heavily influenced by NUnit, a .NET unit testing tool. NUnit introduced annotations as a method of writing tests into code.
Andy Glover, CTO of unit testing tool provider JNetDirect, welcomed the update, saying JUnit had not supported some methods Glover said he uses.
“JUnit is somewhat inflexible in the sense of there is this notion of fixtures in JUnit—of your setup and your teardown,” he said. “The JUnit model is very strict in the sense that you have to have a fixture for each test case.
“Another thing you can’t do very well in JUnit is group tests,” he continued. “A true unit test should run in a couple of seconds. Then there are integration tests, but they use a database or a file server. Then there are system tests. But as you go up that stack, the test case itself takes a lot longer to run, and that’s where test grouping comes into power. I can run those tests at different frequencies. I wouldn’t want to run my integration tests every time I check in code, because they take a long time.”
Aside from test grouping, all the issues Glover had with JUnit have been addressed in JUnit 4. Group tests, also known as categorizations, Beck said, will be addressed in a future release—not in the initial release of JUnit 4.


|