JUnit 4.0 released – Annotations based TestCase definitions

Lucas Jellema

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)
Next Post

Getting started with the EJB 3.0 Query Language (EJBQL 3.0) using GlassFish reference implementation

Facebook0TwitterLinkedinThis article is the sequel to EJB 3.0 Persistence – Introducing EJBQL 3.0, an introduction to EJB QL from an historical, strategic and functional perspective. In this post I want to show you the goods: what does the EJB QL code look like with EJB 3.0 Persistence for doing Native […]