The differences between JUnit 3 and JUnit 4 [close

2019-01-22 11:16发布

问题:

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

回答1:

  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.