欢迎来到天天文库
浏览记录
ID:52296895
大小:26.00 KB
页数:2页
时间:2020-03-26
《软件测试课件(2012版) 求最大值测试代码.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、packagelargest;importjunit.framework.TestCase;publicclassLargestTestextendsTestCase{publicLargestTest(StringtestName){super(testName);}@OverrideprotectedvoidsetUp()throwsException{super.setUp();}@OverrideprotectedvoidtearDown()throwsException{super.tearDown
2、();}/***Testoflargestmethod,ofclassLargest.*/publicvoidtestSimple(){assertEquals(9,Largest.largest(newint[]{7,8,9}));}publicvoidtestOrder(){assertEquals(9,Largest.largest(newint[]{9,8,7}));}publicvoidtestDub(){assertEquals(9,Largest.largest(newint[]{9,8,9,7
3、}));}publicvoidtestOne(){assertEquals(9,Largest.largest(newint[]{9}));}publicvoidtestNegative(){assertEquals(-7,Largest.largest(newint[]{-9,-8,-7}));}publicvoidtestEmpty(){try{Largest.largest(newint[]{});fail("shouldhavethrownanexception");}catch(RuntimeExc
4、eptionEx){assertTrue(true);}}}
此文档下载收益归作者所有