如果你遵循测试驱动开发的实践,那么实际上你将在开发你的代码之前开发你的测试。
If you follow the practice of test-driven development, you will actually develop your tests before you develop your code.
测试驱动开发的基本概念是,在写项目代码之前,你写一段简单的代码来测试你假设的项目代码,以获得预期的反应。
The basic concept of test-driven development is that before writing project code, you write a simple piece of code that tests your hypothetical project code for desired behavior.
在这个系列的前两期中,我讨论了如何使用测试驱动开发(TDD)帮助您逐步发现设计。
In the previous two installments of this series, I discussed how using test-driven development (TDD) helps you incrementally discover design.
我曾目睹这样的情况:与采用测试驱动开发之前相比,团队将缺陷率降低到5%(甚至更低!)……同时以比当初预期更快的速度交付项目。
I have seen teams doing this that reduce defect rates to 5% (or less!) of what they once were prior to test driven development... while at the same time delivering projects faster than expected.
当我进行测试驱动开发时,时间过得飞快。
本文概述的实践中,有一些可归类到常用的测试驱动开发(TDD)实践。
Several of the practices outlined here can be categorised as general Test Driven Development (TDD) practices.
比如,您可以以迭代和测试驱动开发开始,然后可以遵循成对编程和配置团队的原则。
For example, you may start with iterative and test-driven development, and then follow up with pair programming and collocated teams.
对于测试驱动开发,您必须稍微改变一下思考方式。
For test-driven development, you have to twist your thinking a little bit.
倘若必要的反馈要求你的设计(和代码)在产品开发中得到改进,则重构是测试驱动开发中不可缺少的步骤。
Refactoring is an essential step in test-driven development, providing the necessary feedback that allows your design (and code) to improve as the product develops.
测试驱动开发(TDD)改变了编码的过程,并且这种改变不仅是可能的,同时也是值得去做的。
Test-driven development (TDD) alters the process of writing code so that change is not only possible, but desirable.
测试驱动开发的实践——加上持续集成,如果实施得当,就能大大减少低质量产品流入测试阶段的机会。
The practice of test driven development - and continuous integration, if implemented properly, reduces the chance of low quality products being released for QA testing.
两个开发者在一块并不能像分开打字那么快,但是我们并不担心:软件开发的瓶颈是思考[不是打字],而结对编程和测试驱动开发都能提高思考效率。
Two developers together don’t type as fast as two developers separately, but we don’t care: the bottleneck is the thinking [not the typing], and pairing and TDDing both improve it.
测试驱动开发能克服开发团队遇到的许多问题:开发团队经常在代码实现之后才创建单元测试。
Test Driven development overcomes many of the issues faced by development teams that often leave the creation of Unit Tests until after the implementation.
一位波士顿的敏捷培训师正在提供测试驱动开发的免费培训。
An Agile trainer in the Boston area is offering free training in Test Driven Development.
在测试驱动开发中,跟团队成员执行的手动测试相比,自动测试的编写应该放在首要位置。
In test-driven development automated tests should be written in the first place, in comparison to manual tests performed by team members.
项目编码初期,不整理代码,不写单元测试,也不做测试驱动开发,整个团队粗制滥造出更多的“故事场景”。
At first it’s faster to write code without tidying up, without writing unit tests, without doing Test Driven Development, so the team churns out more stories.
或许最令人惊讶的事实是日渐增长的对于测试驱动开发和依赖注入的重视。
Probably the most surprising revelation is the increased emphasis on test driven development and dependency injection.
在许多项目中,开发人员在书写代码的同时书写单元测试——或者有时甚至提前(如在测试驱动开发中)。
In many projects, developers write unit tests at the same time — or sometimes even before (as in test-driven development) — they write their code.
扩展传统测试驱动开发方法系统,确保系统回归测试套件随所有新特性和补丁演变。
Extended traditional test-driven development methodologies to ensure the system regression suites evolved with all new features and fixes.
对于很多开发人员来说,从测试驱动开发转移到BDD是明智的转变。
For many developers, the shift from test-driven development to BDD is a smart move.
测试驱动开发允许你推迟决定,直到你更好地理解了问题之所在。
Test-driven development allows you to defer decisions until you understand the problem better.
在可重用框架的场景下,通过测试驱动开发设计出的框架是真实可用的,而不是简单地推理。
Test driven development, in the context of reusable frameworks, is seen as a way to design frameworks that are actually usable rather than simply speculative.
下一部分:我将通过测试驱动开发(我已经将其命名为 测试驱动设计)讨论紧急设计。
Next up: I talk about emergent design through test-driven development, which I've renamed test-driven design.
使用测试驱动开发,在实现代码时,就要仔细考虑测试,并建立起测试。
With TDD the tests are thought out and created as the code is implemented.
抱歉,比起只是写代码,然后抛给墙那边的QA去测试来说,测试驱动开发(TDD)确实更快!
Sorry, but test-driven development (TDD) is actually faster than just writing the code and throwing it over the wall to QA!
想以测试驱动开发来构造算法的做法是愚蠢的,他只会使人们更容易误认为测试驱动开发不是一个有效的设计技术。
Trying to offer TDD as an algorithm generator is dopey and it's just going to make it easy for people not to take TDD seriously as a valid design technique.
测试驱动开发可以提高生产效率,因为它有助于思考。
TDD increases your production because it serves as a thinking-aid.
另外一个很大的推动力就是测试驱动开发。
好消息是,测试驱动开发不仅仅适合于新代码。
The good news is that test-driven development isn't just for new code.
不过,现在还很难下结论,因为尝试过测试驱动开发的人还是少数。
However, I think it is hard to tell at the moment because not enough people have tried the test-driven development approach.
应用推荐