欢迎来到天天文库
浏览记录
ID:62496252
大小:215.97 KB
页数:13页
时间:2021-05-10
《JUnit测试框架的使用(含测试用例)..docx》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、[软件测试实验报告]计算机2010-1姓名:周杰学号:3100717102JUnit测试框架的使用【实验目的】1掌握Junit测试框架的使用2、掌握测试用例的编写【实验环境】操作系统:Windows7(x64)Windows版本Windows7捏规肢抵权带有C2009Microsoft5中oration,噪畧所有权利.ServicePack1三]InternetExplorer浏览器:IE9..厂:、WindowsInternet显Explorer9版本:9.0.8112.1&421塁議極奎:9.0.M淞£761451〕开发环境:EclipseIDEforJavaDevelopers$Abou
2、tEclipseEclipseIDEfb『」avaDevelopersVersion:JunoServiceRelease1Buildid:20120920-0800ic)CopyrightEclipsecontributors;3ndothers2000”2012.AKrightsreserved^Visithttp:;7edip5e.org/Thisproductindudessoftwaredevelopedbythe?'InstallatJonDetailsjA:Junit使用方法示例1£Java-coolJUnit/teatsrt/ihouje/SampleC^kulatorjav^
3、-Eclipse]■■■FileEditSourceRefactorNavigateSearchProjectRurWindowHelpXnpreject
4、2J*SanTiplcCalcul3tor.ja'3送懵PackageE...Ja□』Vz?-coolJUnitL乎Src£l_?testsre丿ttf2hoiijiej}SarnpleCal骂.JRESyEtennLibra>母JUnct4+/*KQpackagezhoujie;+importstaticore.juriit►Assent►*;_ri1^authorAd(ninistratorpublicclanSamplecalcu
5、lator{publicintadd(intaugendjintadcfend){returnaugend+addend;/7卩箕再要5&K輕publicintsubtr5tion(intirinuend?intsubtrahend)^returnminuend-subtrahend;言NewJUnitTestCaseJUnitTestCaseSelectthenameofthenewJUnittestcase.Youhavetheoptionstospecifytheclassundertestandonthenextpage,toselectmethodstobetested.NewJUn
6、it3testoNewJUnit4testSourcefolder:coolJUnit/testsrcPackage:zhoujieName:SampleCalculatorTestSuperclass:java」ang.Object□XBrowse...Whichmethodstubswouldyouliketocreate?setUpBeforeClassO□tearDownAfterClassOIsetUpOjtearDown。nvonstructorDoyouwanttoaddcomments?(Configuretemplatesanddefaultvaluehee)Generate
7、commentsClassundertestzhoujie.SampleCalculatorBrowse...FinishCancel占NewJUnitTestCaseTestMethodsSelectmethodsforwhichtestmethodstubsshouldbecreated.Availablemethods:■130回▲L@□nsBSampleCalculator0add(int,int)Osubtration(int,int)Object•cObjectOgetClassO•NhashCodeO•equals(Object)FileEditSourceR
8、efactorNavigateSearchProjectRunWindowHelp蔭PackageExplorer滋□i.JUnitJjsb!coolJUnil皆srcj.'出te^tsrc“
9、.闿zhoujia!>JUSampfeCalculator.java,J_SampleCalculatorTestjaval>in.JRESystemLibrary'a.iSFiffeJUnit4FileE
此文档下载收益归作者所有