Programming By Intention/Intro to JUnit

Admin

►Astels, p. 50 – “The test in the section titled Programming by Intention…” should read “The test in the section titled Do the Simplest Thing…

►Quizzes

§Read the question

§Handling quiz opt-outs

§Two items != one item worded two ways

§Refactoring key – Not changing functionality

§Shotgun Surgery = having to make changes in multiple places for one functional change

Programming By Intention

►Methods for keeping code as good as possible

►Guidelines we’ll follow for code we write in this class

Naming

►Nouns for class names/variables (Person, Order, Item)

►Adjectives/generic nouns for interfaces (Testable, Database, Iterator)

►Verbs for method names (Save, calculateTotalInterest)

►getX(), setX(), isX(), hasX()

►Leave out redundant info

Simplicity

►Make code as simple as possible to do what’s needed

►Use refactorings to keep things simple

►Use test-first programming

Assumptions

►Make assumptions while you write your test

►Makes you think about your code from the standpoint of using the code, which means your code plays better with others

►Don’t worry about tracking the assumptions you make, let the compiler tell you

Comments

►Not all comments are bad

►Examples of good comments

§Todo items – incomplete code

§Future refactorings (either by you or someone else)

§Use of uncommon acronym

§Attribution

§Changes made for specific reason (e.g., performance tuning)

§Brief class overview

JUnit

►Developed by Kent Beck and Erich Gamma

►Variant of sUnit (Smalltalk)

►Current version = 3.8.1

►Included in Eclipse and many other IDEs

Structure

►Test Cases

§Extend JUnit TestCase class

§Contain methods which perform actual tests

§Main piece for TDD

►Test Suites

§Contain Test Cases and/or other Test Suites

§Default Test Suite contains all tests

§Generally explicitly defined to allow running subsets of tests

Asserts

►Actual checks performed by test methods

►Two forms – use one with extra string param

►Fail()

►assertTrue/assertFalse

►assertNull/assertNotNull

►assertSame/assertNotSame

►assertEquals

Programming By Intention/Intro to JUnit相关推荐

  1. iPhone 开发中心 论坛 与 视频

    苹果开发者联盟 - iPhone 开发中心  http://www.apple.com.cn/developer/iphone/  http://developer.apple.com/devcent ...

  2. Intro to Parallel Programming CUDA-第二单元

    一.parallel communication patterns   并行通信模式 Map:映射,在特定的位置读取和写入. Gather:收集,从多个不同的位置读入,写入一个位置. Scatter: ...

  3. Intro to Parallel Programming CUDA-第一单元

    一.GPU典型工作流程: 1.CPU在GPU上分配存储 2.CPU把某个输入数据从CPU复制到GPU上 3.CPU调用某些内核来监视这些在GPU上处理这个数据的内核 4.CPU把结果从GPU复制回CP ...

  4. Fast Intro To Java Programming (2)

    Java局部变量 局部变量声明在方法.构造方法或者语句块中: 局部变量在方法.构造方法.或者语句块被执行的时候创建,当它们执行完成后,变量将会被销毁: 访问修饰符不能用于局部变量: 局部变量只在声明它 ...

  5. Basic005. Intro to statistics basic terms统计名词介绍

    本文"植物微生物组"公众号原创,ID: plantmicrobiome 作者:Tank 原文链接:Intro to Statistics with R (HarvardX seri ...

  6. linux c socket programming

    http://54min.com/post/http-client-examples-using-c.html 好文章 PPT http://www.slideshare.net/Arbow/asyn ...

  7. 用JUnit框架实现Java单元测试

    http://tech.it168.com/j/2007-08-27/200708271737659.shtml 单元测试是整个测试流程中最基础的部分,它们要求程序员尽可能早地发现问题,并给予控制,这 ...

  8. Clojure入门教程: Clojure – Functional Programming for the JVM中文版

    http://xumingming.sinaapp.com/302/clojure-functional-programming-for-the-jvm-clojure-tutorial/ api:h ...

  9. 软件测试系列之四 单元测试(Junit)

    在线课堂:https://edu.csdn.net/lecturer/1516  单元测试简介 单元测试就是测试程序员依据其所设想的方式开发出来的程序是否产生了预期的结果.单元测试是与软件开发生命周期 ...

最新文章

  1. Spring Boot+JWT+Shiro+MyBatisPlus实现Restful快速开发后端脚手架
  2. 取一个字符串中的数字
  3. php 简单的存在 (方法之间的神奇作用:容错)
  4. VTK:PolyData之CellEdgeNeighbors
  5. 将Doc或者Docx文档处理成html的代码逻辑;统计word中的字数,段数,句数,读取word中文档内容的代码逻辑
  6. 计算机应用的问答题,计算机应用技术问答题(一)
  7. oss上传判断_OSS
  8. 2.1Android底层开发需要哪些工具
  9. 三列自适应布局(圣杯布局)
  10. win7自带桌面便签
  11. 三菱驱动器参数表_三菱伺服驱动器参数都设置什么啊 详细点 谢谢
  12. C#实现给图片加边框的方法
  13. PS制作android图标
  14. bootstrap4和bootstrap3的区别
  15. HDU 5238 线段树+数论
  16. 【线代】矩阵的秩(秩:非零子式的最高阶数)
  17. 雷军亲自站台,游戏手机能否成为市场增长新引擎?
  18. 关于QQ pc端登录界面的测试用例 11——28
  19. C++(25)——STL
  20. python神经网络编程 豆瓣,用python构建神经网络

热门文章

  1. 2019 目标检测指南
  2. linux下操作svn,实现根据时间段查看某个指定用户提交的记录
  3. 模拟电路:晶体管偏置
  4. Linux服务器如何实现Rdesktop连接?
  5. php fetchall与fetch,PDO :: fetchAll与PDO :: fetch在循环中
  6. 35 岁以上Android开发者都去哪里了?,三面蚂蚁核心金融部
  7. 2020电工(高级)操作证考试及电工(高级)模拟考试题库
  8. python3.7游戏_python3.7自动点击脚本点击游戏窗口内游戏道具不生效
  9. PS在照片中添加文字并做适当模糊处理
  10. 跨境电商亚马逊2022年亚马逊店铺策略解析(一)