JUnit 4.0 released - Annotations based TestCase definitions americas cup win 2682133k1

JUnit 4.0 released – Annotations based TestCase definitions

Last week, release 4.0 of JUnit was published. You may have seen some of the announcements. The JUnit homepage (http://www.junit.org/index.htm)does not reflect this fact at the time of writing, but the 4.0 Jar is available for download at SourceForge (http://sourceforge.net/project/showfiles.php?group_id=15278). I found a very good article for getting started with this JUnit release: JUnit 4.0 in 10 minutes by Gunjan Doshi (Instrumental Services Inc. ). It very conscisely explains what is new about this release and how it will influence the way we use JUnit.

Some important conclusions:

  • JUnit 4.0 requires JDK 5.0 as it uses annotations to specify which classes are TestCases (no extension of TestCase is required) and which methods are in fact UnitTests (the method name does not need to begin with test)
  • This release makes writing tests a little easier and little more flexible (no more mandatory TestCase superclass for example)
  • Old (pre 4.0) JUnit Tests can still be run with the 4.0 Runner
  • The current generation of IDEs does not know about the JUnit 4.0 style of annotating classes, hence we will need an Adapter until they are up to speed (the adapter is part of the JUnit 4.0 release)