- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
使用JUnit进行单元测试
选择下载junit4.5.zip文件,然后解压到本地,并在系统环境变量classpath中添加junit-4.5.jar文件的路径,此时则可以在dos环境下运用命令行来进行测试
例如,测试junit自带的用例:
Java org.junit.runner.JUnitCore org.junit.tests.AllTests
在Eclipse中进行单元测试
1.建立一个要测试的类:如Math.java
2.建立JUnit测试类:
为与源文件区分,将测试类放在一个新建的包里(一般将源文件包路径的第一级名称改为test,后面不变即可。)类名一般为源类名+test:
注意上图最下部分有警告,提示要将JUnit jar包导入到工程:
下一步选择类中要进行测试的方法:
MyEclipse生成了一个JUnit测试类的框架:
被测试的方法前面都有一个“@Test”的注释,这表示该方法要进行测试,可以在其后加上“@Ignore”表示忽略掉该测试方法。
测试方法名一般为test + 源方法名
编写完测试代码后,以“Run As JUnit Test”方式运行该测试类:
JUnit测试管理器将显示测试的结果:
也可以单独选择某个方法进行测试:
参数化的测试类:
Manufacturing transformation and development planning1 comprehensive strength of the manufacturing industry to upgradeRelying on good traffic conditions and location advantages of the industrial base, the manufacturing industry comprehensive strength steadily, the total size of the total, technical level, economic benefits and so on in the country has become the cornerstone of the precedent, the citys economic and social development and an important support. 12th Five-Year period, the total industrial added value, the average annual growth rate of dada%, the amount of the total amount of investment of the citys industrial enterprises with an average annual growth rate%, above scale industrial enterprises realized a total profit of the average annual growth rate of%.xx years, the citys above scale industrial output mode billion yuan output value of over 80 billion yuan of industrial dada to 8, above scale industrial added value billion yuan, industrial growth. Added value accounted for GDDP%, the resident population per capita GDP reached million, ranked second in XXX Province, the national large and medium-sized cities in the forefront.2 continuous optimization of industrial structureThe benefit oriented, high end orientation and the direction of intensive development, gradually increase efforts to promote the transformation of industrial structure adjustment and optimization of indust
您可能关注的文档
最近下载
- 水污染控制工程(第4版)全套PPT课件.pptx
- 2025年,跨境电商数据合规性风险评估与合规体系建设指南报告.docx
- (2025秋新版)部编版二年级语文上册《 语文园地二》PPT课件.pptx VIP
- 2024年社会工作者中级《社会工作实务》真题及答案解析.pdf VIP
- JGT 366-2012-外墙保温用锚栓.pdf
- 基坑坍塌事故专项应急预案桌面演练脚本.docx VIP
- 小学阶段需要掌握的文学常识.docx VIP
- 课件mike新11hd so nam模型培训教程.pdf
- 《控制工程基础》教案.docx VIP
- Q∕GDW 11021-2013 变电站调控数据交互规范.docx VIP
文档评论(0)