junit.framework.Assert 与org.junit.Assert

来源:互联网 发布:软件测试就业怎么样 编辑:程序博客网 时间:2024/05/23 00:07

differences between 2 JUnit Assert classes


The old method (of Junit 3) was to mark the test-classes by extending junit.framework.TestCase. That inherited junit.framework.Assert itself and your test-class gained the ability to call the assert-methods this way.

Since version 4 of junit the framework uses Annotations for marking tests. So you no longer need to extend TestCase. But that means, the assert-methods aren't available. But you can make a static import of the new Assert-class. That's why all the assert-methods in the new class are static methods. So you can import it this way:


Junit相关文章:

全面认识JUnit4.0


原创粉丝点击