<<TDD by example>> notes
Why TDD?*****
1. Automated test
---Game in TWI
---stress->高->testing少->errors多->stress高
---stress->高->自动testing多->errors少->stress低
2. For design, we use test to drive the design instead of design first and then write the test.
---Think from the consumer point of view. Think from the interface. Avoid over design.(Consumer aspect)
---Your designs must consist of many highly cohesive, loosely coupled components, just to make testing easy. (Highly cohesive, loosely coupled)
3. Continuous feed back
---A working test is a step closer to having every thing working.
1. Two simple rules of TDD.
---Write a failing automated test before you write any code.
---Remove duplication.
The two rules imply thean order to the tasks of programming.
Red/Green/Refactor
2. Manage a todo list during TDD. How to do the tasking?
---From the business value point or the implementation task point?*****
3. We have a failing test and we want it to go green as quickly as possible, even by returning the expected result directly.
Why so hurry to green? What if I forget that green is a fake one?*****
We use triangulation to avoid it. What's more, we only work on one place, so we won't fake in more than 2 places.
Triangulation sometimes feels funny, so it is only used when we are unsure how to refactor.
(4. The Money value object.)
5. Never interrupt an interruption.
6. There is no right step size in TDD. TDD is a steering process--a little this way, a little that way.
---Do we need to design in advance? Sometimes we can keep the Todo list as a roadmap.*****
(7. Any time you are checking classes explicitly, you should be using polymorphism instead.)
if(animal instanceof Foo)...
8. When the todo list becomes empty, it is the time to review the design.
9. TDD followed religiously should result in 100% statement coverage.
10. Regression Test. When a defect is reported, write the smallest possible test that fails, and that once it runs, the defect will be repaired. Think about how you could have know to write the test in the first place.
11. Cases:*****
Uri format, empty, exist. NotEmpty.
Patterns
Test-Driven Development Patterns
---Test n. Use automated test to lower the stress
---Isolated Test
---Test List (I understand it as a todo list?)
---Test First
---Assert First
------Where should you start building a system? With stories you want to be able to tell about the finished system.
------Where should you start writing a bit of functionality? With the tests you want to pass with the finished code.
------Where should you start writing a test? With the asserts that will pass when it is done.
---Test Data
---Evident Data
Red Bar Patterns
---One Step Test. Which test should you pick next from the list? Pick a test that will teach you something and that you are confident you can implement.
---Starter Test. Start by testing a variant of an operation that doesn't do anything, because we need to solve the problem of "where does it belong?" first and a "realistic" test has a bunch of problems to solve.
One Step Test applies after the starter test.
---Explanation Test. Ask for and give explanations in terms of tests. Specification by example???
---Learning Test. Tests to assert some functions of the existing systems.
---Another Test. New ideas are written down on the list to avoid distraction from current work.
---Regression Test. When a defect is reported, write the smallest possible test that fails, and that once it runs, the defect will be repaired. Think about how you could have know to write the test in the first place.
---Break
---Do Over. Throw away the code and start over if you are feeling lost.
---Cheap desk, Nice Chair.
Testing Patterns
---Child test. A test too big. Write smaller one represents the broken part.
---Mock Object
---Self Shunt. Communicate with the test case
---Log string
---Crash Test Dummy
---Broken test. Keep a broken test when working alone.
---Clean check in. Team work, clean check in.
Green Bar Patterns
---Fake it. To get it quickly green, return a constant as the fake.
---Triangulate
---Obvious implementation.
---One to many
XUnit Patterns
---Assertion
---Fixture
---External fixture
---Test Method
---Exception Test
---AllTests
分享到:
相关推荐
### Test-Driven Development (TDD): By Example #### 引言 在软件开发领域,测试驱动开发(Test-Driven Development, TDD)是一种被广泛推崇的方法论,它提倡在编写实际代码之前先编写测试用例。这种方法不仅能...
《测试驱动开发示例》是由Kent Beck撰写的一本关于TDD(Test-Driven Development,测试驱动开发)的经典书籍。本书特别适合Java开发人员阅读,它不仅介绍了TDD的基本概念和实践方法,还通过实际案例,一步步带领读者...
《测试驱动开发实战》这本书是Kent Beck的经典之作,它详细阐述了Test-Driven Development(TDD)的概念、方法和实践。TDD是一种软件开发过程,其中编写测试代码在编写实际功能代码之前进行,以确保软件的高质量和可...
非常经典的一本书:通过实例学习测试驱动开发。<br>作者:Kent Beck
iOS Test Driven Development by Tutorials FIRST EDITION, Learn real-world test-driven development PDF & EPUB & SourceCode
《Test-Driven Development By Example》是一本由Kent Beck所著的经典书籍,书中详细介绍了TDD的概念、实践和原则。 在TDD流程中,首先编写一个失败的单元测试,这个测试针对的是待开发功能的一个最小可执行部分。...
Test Driven Development: A J2EE Example by Russell Gold, Thomas Hammell and Tom Snyder ISBN:1590593278 Apress © 2005 (296 pages) Targeted at Java developers who want to learn how to use test-...
raywenderlich官方教程,iOS Test-Driven Development by Tutorials,包含源码。
测试驱动开发(Test-Driven Development, TDD)是一种软件开发方法论,它强调在编写功能代码之前先编写测试用例。这种方法有助于确保代码质量,并能提高软件的可维护性和可扩展性。本书《测试驱动开发:一个J2EE实例...
- **排除默认拦截器**:如果`<mvc:annotation-driven />`包含默认拦截器,可以考虑使用`<mvc:default-servlet-handler>`或`<mvc:annotation-driven enable-matrix-variables="false" />`来禁用它们。 - **调整拦截器...
Test Driven Development with Django 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请...
标题"aw - test-driven development by example"表明我们将探讨TDD的实践案例。 **TDD的基本步骤** 1. **编写测试**:首先,开发者为待实现的功能编写一个失败的单元测试。这个测试应明确地定义了功能的预期行为。...
Test-driven development replies to this contradiction with a paradox-test the program before you write it. A new idea? Not at all. Since the dawn of computing, programmers have been specifying the ...
在Android开发领域,Test Driven Development(TDD)是一种被广泛应用的编程实践,它强调先编写测试用例,再编写满足这些测试的代码。在这个"Android Test Driven Development Tutorials"资源包中,包含了PDF、ePub...
《测试驱动开发》(Test-Driven Development by Example)是由软件工程领域的大师Kent Beck所著的一本经典著作。该书主要介绍了测试驱动开发(TDD)的方法论,并通过具体的例子来展示如何有效地运用这一开发模式。本书...
Test-Driven Development with Python(2nd) 英文epub 第2版 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
By taking you through the development of a real web application from beginning to end, the updated second edition of this hands-on guide demonstrates the practical advantages of test-driven ...
### 专业测试驱动开发与C# #### 知识点概览 1. **测试驱动开发(TDD)的概念** 2. **TDD的核心原则与实践** 3. **单元测试介绍** 4. **重构技巧** 5. **让测试指导开发流程** 6. **模拟外部资源** ...