I was a little surprised that obviosuly noone else has posted the release of JUnit 4 on SDN. JUnit should be of great importance in the SAP-Java world as well as for anyone developing with Java. Although some few days old, the new release has not reached the official website for SEO. To sum up the most important features:
- Using Java 5 language features such as annotations, generics and varargs.
- Providing the “Test”-Annotations for marking tests insted of reflecting by the method name prefix “test”.
- Supporting easy definition of test suites via a list of classes instead of the need to build up a suite programmatically.
- Only one textual test runner delivered.
- Expected exceptions can now be tested by providing an optional parameter to the “Test”-Annotation
- Skipped ExceptionTestCase whose usage could have been classified as antipattern.
- Allowing to define parameterized tests (i.e. sort of data-driven tests) in a clean way with help of annotations.
- Allowing to easily run old unit tests with help of an adapter class.
- Now two package namespaces exist with JUnit: org.junit.* and the old junit.framework.*. The former one representing new implementations.
The most significant change regarding developers is the usage of Java 5. Meaning that you cannot use JUnit with older Java versions. The currently (02/28/06) published release is release candidate 1. But candidate 2 has been available inofficially and shows some noticeable changes compared to its predecessor. The source code in the CVS has also evolved in the meantime. Soon, an article of mine describing JUnit 4 in more detail will be published in the German JavaMagazin