JUnit is a unit testing framework for Java which has been around for years. It was originally developed by
Kent Beck and
Erich Gamma and is now maintained by the community which has recently
released JUnit 4.5. In the many years that JUnit has been around numerous projects in the xUnit family have been spawned including:
Even with years of development effort and usage on countless software projects around the world
some continue to wonder if JUnit's fate is nearing its end. Often times when someone (or some group) of people begin to doubt the long term existence of a software project they will rely on web page viewing statistics. Just this week
Mike blogged about the declining "interest" in JUnit based upon search engine results. Although he concludes by stating he doesn't believe JUnit is dead there seems to be some inclination that perhaps JUnit is being surpassed. One reason might be that as newer and better software practices evolve more and more developers catch on to them. Unit testing is certainly important and widely accepted, however, behavior driven development, mock objects and newer-featured unit testing frameworks are standing in the spotlight.
One framework which is often compared to JUnit is
TestNG, a testing framework inspired by JUnit.
Michael Minella provides a brief but useful comparison between JUnit and TestNG.
Feature |
JUnit |
TestNG |
User Defined Life Cycle |
|
|
Test Organization (groups, etc) |
|
|
Distributed Test Execution |
|
|
Parallel Test Execution |
|
|
Data Driven Tests |
|
|
Dependency Testing |
|
|
IDE Integration |
|
|
Ant Integration |
|
|
Maven Integration |
|
|
Domain Specific Extensions (Database, HTTP, etc) |
|
|
Active Community |
|
|
source To summarize his thoughts, JUnit has been adopted and extended more so than TestNG, however, TestNG seems to offer more functionality and has the ability to invoke JUnit tests, making it a tempting choice in testing frameworks.
In conclusion, JUnit may not be in the spotlight as much as it was a year ago, but is it really walking closer towards the 'bright light'? What do you think, what does the future have in store for JUnit?