Most Read Latest News Blog Resources

JUnit 4 Adds Annotations




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.


Share this link: http://www.sdtimes.com/link/29153
 

Add comment


Name*
Email*  
Country     


  • Comment
  • Preview
Loading



 
 
 
 
News on Monday
more>>
SharePoint Tech Report
more>>


   

 
 
Download Current Issue
ISSUE 3/15/2010 PDF

Need Back Issues?
DOWNLOAD HERE

Receive the print Edition?


 
blogs tab
Google Code turns 5
Google Code Turns 5, and adds a Paxos Algorithm to make the system more stable and reliable.
03/17/2010 11:16 AM EST

Test your Visual Studio 2010 know-how
Microsoft is offering free beta certification exams for Visual Studio 2010.
03/17/2010 11:08 AM EST

Microsoft lifts the hood on IE9
Microsoft is previewing IE9.
03/16/2010 01:10 PM EST

 

Events calendar tab
3/22/2010 to 3/25/2010
Santa Clara, Calif.
The Eclipse Foundation

4/12/2010 to 4/14/2010
Las Vegas
Penton Media

4/12/2010 to 4/15/2010
Santa Clara, Calif.
O'Reilly Media

4/19/2010
New York City
Flagg Management

4/25/2010 to 4/28/2010
Overland Park, Kans.
IIUG