junitjunit4junit3

The differences between JUnit 3 and JUnit 4


Could someone describe in a few words what the main differences between JUnit 3 and 4 are?


Solution

    1. Java 5 annotations for setup and teardown (@before and @after) instead of setUp() and tearDown().

    2. don't need to extend TestCase anymore.

    3. @Test annotation replaces testSomeMethod() naming convention.

    4. static imports for asserts.

    5. Junit theories, which allow you to separate data sets from the test itself.