- 1、本文档共26页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Juni开发教程
JUnit Tutorial Hong Qing Yu Nov 2005 JUnit Tutorial The testing problems The framework of JUnit A case study JUnit tool Practices The Testing Problems The Testing Problems Programmers need such kind of tool: “Writing a few lines of code, then a test that should run, or even better, to write a test that wont run, then write the code that will make it run.” JUnit Tutorial The testing problems The framework of JUnit A case study JUnit tool Practices The Framework of JUnit JUnit Tutorial The testing problems The framework of JUnit A case study JUnit tool Practices A Case Study } How to Write A TestCase public class MoneyTest extends TestCase { ??? //… ??? public void testSimpleAdd() { ??????? Money m12CHF= new Money(12, CHF);? //?(1) ??????? Money m14CHF= new Money(14, CHF); ???????? ??????? Money expected= new Money(26, CHF); ??????? Money result= m12CHF.add(m14CHF);??? //?(2) ??????? Assert.assertTrue(expected.equals(result));???? //?(3) ??? } } (1) Creates the objects we will interact with during the test. This testing context is commonly referred to as a tests fixture. All we need for the testSimpleAdd test are some Money objects. (2) Exercises the objects in the fixture. (3) Verifies the result Assert assertEquals(expected, actual) assertEquals(message, expected, actual) assertEquals(expected, actual, delta) assertEquals(message, expected, actual, delta) assertFalse(condition) assertFalse(message, condition) Assert(Not)Null(object) Assert(Not)Null(message, object) Assert(Not)Same(expected, actual) Assert(Not)Same(message, expected, actual) assertTrue(condition) assertTrue(message, condition) Structure setUp() Storing the fixtures objects in instance variables of your TestCase subclass and initialize them by overriding the setUp method tearDown() Releasing the fixture’s run() Defining how to run an individual test case.
您可能关注的文档
最近下载
- 中医养生预防脑血管疾病的措施(3).pptx
- 教育部2024年专项任务项目(高校辅导员研究)申请评审书《增强高校辅导员与学生谈心谈话的针对性和实效性研究》.docx VIP
- YBJ-PS03-2004埋地无压预制混凝土排水圆形管管基及接口.pdf
- 家校社协同育人教联体典型案例(幼小中).doc
- 智慧教育双师课堂解决方案.pdf
- DL∕T 1949-2018 -火力发电厂热工自动化系统电磁干扰防护技术导则.pdf
- 2023云南昆明空港投资开发集团招聘7人考前自测高频考点模拟试题(共500题)含答案详解.docx
- 营销三大法宝-销售带动配合-PPT课件.ppt
- 人教版本历史七下第3课(开元盛世)课件3.ppt
- 2025考研英语一真题及答案.pdf
文档评论(0)