setUp方法:測試方法執行前,初始化測試條件和測試數據。
tearDown方法:測試方法執行后,撤銷。
Fixture 不在構造方法中
數據庫測試中
setUp //反序列化數據
tearDown //刪除數據,自動啟動事務回滾
OCP:開閉
擴展是開放的,修改是封閉的。
TestRunner
TestSuite
Eclipse中的JUnit的實現,runAs
junit.extensions.RepeatedTest 回歸測試
框架好,擴展很容易。
Decorator 修飾模式/裝飾模式
原來的接口、基礎不變,增加新功能。
回歸測試
TestSuite.addTest(new RepeatedTest(new TestSuite(HelloWorldTest.class),10));
名稱要很好的反映邏輯操作。
使用上
與Ant/Make工具儀器使用,每日部署、測試。
Mock Oject 模擬對象
文章來源于領測軟件測試網 http://www.kjueaiud.com/