读书笔记《测试驱动开发》

原创 2004年06月23日 19:33:00
After read the . Let me make a conclusion.

All the theory can be express by some Q&A

PART I------------------------------------------------------------

Q: How do you test your software?
A: Write an automated test.

Q: How should the running of tests affect one another:
A: Not at all.

Q: What should you test?
A: Before you begin, write a list all the tests you know you will have to write.

Q: When should you write you test?
A: Before you write the code that is to be tested.

Q: When should you write the asserts?
A: Try writing them first.

Q: What data do you use for test-first tests?
A: Use data that makes the tests easy to read and follow. (...)

Q: How do you represent the intent of the data?
A: Include expected and actual results in the test itself, and try to make their relationship apparent.

PART II-----------------------------------------------------------

Q: Which test should you pick next from the list?
A: Pick a test that will teach you something and that you are confident you can implement.

Q: Which test should you start with?
A: Start by testing a variant of an operation that doesn’t do anything.

Q: How do you spread the use of automated testing?
A: Ask for and give explanations in terms of tests.

Q: When do you write tests for externall produced software?
A: Before the first fime you are going to use a new facility in the package.

Q: How do you keep a technical discussion from straying off topic?
A: When a tangential idea arises, add a test to the list and go back to the topic.

Q: What do you do when a defect is reported?
A: Write the smallest possible test that fails and that, once run, will be repaired.

Q: What do you do when you are feeling lost?
A: Throw away the code and start over.

PART III(Detail)----------------------------------------------------

Q: How do you get a test case running that turns out to be too big?
A: Write a smaller test case that represents the broken part of the bigger test case.

Q: How do you test an object that relies on an expensive or complicated resource?
A: Create a fake version of the resource that answere constants.

Q: How do you test that one object communicates correctly with another?
A: Have the object under communicate with the test case instead of with the object it expect.

Q: How do you test that the sequence in which messages are called is correct?
A: Keep a log in a string, and append to the string when a message is called.

Q: How do you test error code that is unlikely to be invoked?
A: Invoke it anyway whith a special object that throws an exception instead of doing real work.

Q: How do you leave a programming session when you’re programming alone?
A: Leave the last test broken.

Q: How do you leave a programming session when you’re programming in a team?
A: Leave all of the tests running.

PART IV----------------------------------------------------------

Q: What is your first implementation once you have a broken test?
A: Return a constant.

Q: How do you most conservatively drive abstraction with tests?
A: Abstract only when you have two or more example.

Q: How do you implement simple operations?
A: Just implement them.

Q: How do you implement an operation that works with collections of objects?
A: Implement it without the collections first, then make it work with collections.

--------END--------

《测试驱动开发》--读书笔记

《测试驱动开发》--读书笔记
  • ggf123456789
  • ggf123456789
  • 2015年02月06日 04:03
  • 701

测试驱动开发之初窥门径

JUnit的作者Kent Beck说过:编写测试驱动代码的重要原因是消除开发中的恐惧和不确定性,因为编写代码时的恐惧会让你小心试探,让你回避沟通,让你羞于得到反馈,让你变得焦躁不安,而TDD是消除恐惧...
  • jackfrued
  • jackfrued
  • 2015年03月19日 10:43
  • 3329

说说测试驱动开发

1 测试驱动开发模式1.1 重新定义“测试”这是一张影响图: 普通箭头表示当第一个节点增长时,第二个节点也会做相应的增长。 带圆圈的箭头表示当第一个节点增长时,第二个节点也会做相应的减少。 当压力越大...
  • deniro_li
  • deniro_li
  • 2017年04月28日 10:53
  • 1999

测试驱动开发(TDD)实战小例子(JAVA版)

我们知道,测试驱动开发(TDD)的基本思想就是在开发功能代码之前,先编写测试代码。也就是说在明确要开发某个功能后,首先思考如何对这个功能进行测试,并完成测试代码的编写,然后编写相关的代码满足这些测试用...
  • sunli880127
  • sunli880127
  • 2013年10月17日 15:24
  • 1758

测试驱动开发(tdd) 学习笔记(1)基本思想原则和术语

    这几天学习了一下测试驱动开发(tdd) 实用指南,感觉相见恨晚,收获很大。以前也听别人说过测试驱动开发,也用过dunit,但是当时不知道具体的含义,也没有仔细研究一下,真是遗憾。   Test...
  • bfox
  • bfox
  • 2005年11月27日 10:45
  • 1179

谈谈对测试驱动开发思想的体会

最近学习了一本书《Python Web开发:测试驱动方法》,贯穿全书的便是测试驱动开发的编程思想。有点儿兵马未动,粮草先行的兵家思想。先简单总结一下这本书带给我的收获:1.学习了测试驱动开发的一种编程...
  • u012745215
  • u012745215
  • 2017年11月11日 13:44
  • 237

测试驱动开发优缺点

前言      近期学习了TDD(测试驱动开发),但是由于没有亲身使用太多,所以说不出太多感受,但是看到了一篇博客,觉得讲的挺好的,跟大家分享下。 正题     不觉间,采用测试驱动开发(T...
  • zhaodandan19910306
  • zhaodandan19910306
  • 2015年06月30日 19:16
  • 1875

使用Spring进行测试驱动开发

使用Spring进行测试驱动开发1. 配置和缓存ApplicationContext- 使用JUnit的测试中配置ApplicationContext 引入依赖 junit jun...
  • qq_32768743
  • qq_32768743
  • 2016年08月10日 17:38
  • 383

关于测试驱动开发的思考

关于测试驱动开发的思考          测试驱动开发(Test Driven Develop)作为敏捷思想的重要组成部分,将开发和测试在同一时段完成,我认为是一个很不错的想法,尤其是经历了无数测试...
  • test4ever
  • test4ever
  • 2011年08月15日 15:18
  • 1282

读书笔记《测试驱动开发》一

单个类的开发原则: 从类的小功能开始开发,在具体写实现代码之前,先写测试代码。 通过先写测试代码,能确定类的指定功能较好用的接口。 小函数开发周期:先将问题转为一个测试程序 通过存根等方式尽快使代码通...
  • Virtual_Func
  • Virtual_Func
  • 2017年05月02日 18:01
  • 201
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:读书笔记《测试驱动开发》
举报原因:
原因补充:

(最多只允许输入30个字)