JUnit 4.0 was released recently with hardly any fanfare. It appeared for download on SourceForge well before the official site junit.org reported its release. While JUnit was the parent framework that started the whole test driven development wave, the response to JUnit 4 has been mixed.
The highlights of JUnit 4 are:
* Test classes do not have to extend from junit.framework.TestCase.
* Test methods do not have to be prefixed with ‘test’.
* Assert methods stay the same.
Support for annotations
However JUnit was frozen for quite a while and during this time many other frameworks moved and offered superior features. Annotations support for example has been present in frameworks like JTiger and TestNG for some time.
JTiger creator Tony Morris in a recent interview said that “JUnit is not much more than a glorified if/else construct.” and the only reason to use JUnit is if your code must run in a version prior to J2SE 5.0. However these comments were made prior to JUnit 4.0
So where do things stand today? Is JUnit the best choice because of its wide spread use, the wide IDE support and the easy availability of JUnit aware developers? Or should you adopt a framework like JTiger or TestNG?
Latest posts by Content Team (see all)
- IndicThreads Pune 2016 To Equip Developers For A New Age Of Software Development - May 27, 2016
- Java Garbage Collectors – Moving to Garbage First (G1) Collector - May 25, 2016
- Using Lambdas and Streams in Java 8 - May 18, 2016