規範:java
斷言:assertEquals();assertFalse();等yii
示例:測試
class DemoTest{ @Before public void bef(){ Demo demo = new Demo();//Test方法執行器都會執行 } @Test public void testFunc(){ int result = new Demo.func();//使用匿名對象 int result1 = demo.func(); Assert.assertEquals(1,result);//斷言 } }
靜態引入:import static org.junit.Assert.*表示靜態引入,把Assert下的方法引入,能夠直接調用方法.net
參考博客:code
http://blog.csdn.net/mao520741111/article/details/51462215htm
http://blog.sina.com.cn/s/blog_67aaf4440100zjye.html對象
http://www.yiibai.com/junit/blog
http://www.51testing.com/html/59/305559-211568.htmlget