Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos
On 03/03/06, the same day when the official JUnit homepage was updated to direct to JUnit 4, the next version of the classic JUnit has been released. JUnit 3.8.2 builds upon the "old" Java, though you are not forced to migrate to Java 5 to use it (in opposition to JUnit 4). The new classic release contains several bug fixes as well as some new features. Included are:
  • Most important: for failed comparisons between strings via assertEquals() the differences are marked visually by square brackets.
  • Version number will be printed when starting the test runner.
  • The test runner allows for running single tests.
  • Composition of test suites possible in a new way, the old one kept.
The junit-site advices to use JUnit 4 instead, if possible. This should mainly depend on whether one is using Java 5 in his/her project and whether a number of unit tests already exists. If the latter holds true, JUnit 4 provides a service class, junit.framework.JUnit4TestAdapter, that makes it easy running old-style tests. Just write in your test class (extended from junit.framework.TestCase):
import junit.framework.*; public class MyTest extends TestCase { public static Test suite() { return new JUnit4TestAdapter(MyTest.class); } }
My previous blog entry contains JUnit 4 released.