Summary
Kent Beck released a new version of his Java testing framework. JUnit 4.3 includes a new method of verifying array equality and additional annotations that facilitate the backward compatibility of tests.
Advertisement
JUnit is Kent Beck's ubiquitous Java testing framework. The latest version introduces a few convenience methods, changes how array length is compared, and provides annotations that make the framework more backward compatible.
Significant new features include:
The use assertEquals() to compare array contents is now deprecated. In the future, assertEquals() will revert to its pre-4.0 meaning of comparing objects based on Java's Object.equals() semantics. To compare array contents, use the new, more reliable Assert.assertArrayEquals() methods.
The @Ignore annotation can now be applied to classes, to ignore the entire class, instead of individual methods.
Originally, developers who wanted to use a static suite() method from JUnit 3.x with a JUnit 4.x runner had to annotate the class with @RunWith(AllTests.class). In the common case, this requirement has been removed. However, when such a class is wrapped with a JUnit4TestAdapter ... the results may not be as expected.
Improved error messages for array comparison ("arrays first differed at element [1][0]")
We have covered here on Artima another annotation-based Java testing framework, TestNG. Now that JUnit includes annotations, too, how do you think TestNG and JUnit 4 compare? Which one would you recommend to developers just now starting out with unit testing?