mse

导航

Junit学习笔记(1)

Posted on 2009-05-05 19:23  mse  阅读(130)  评论(0)    收藏  举报

keep the bar green to keep the code clean
单元测试不是证明您是对的,而是证明您没有错误。(因为有些地方可能没有测试到)
1 在Junit3.8中类必须继承TestCase
2 单元测试满足如下原则
1)public
2)void
3)无参数
4)测试方法必须以test开头,testxx(xx可以随便写)

eg.TestCase.assertEquals("1", hello.print());
    或者是调用Assert的静态方法
    Assert.assertEquals("1", hello.print());
    Assert.fail()