ATDD和TDD的区别是什么?

最近看到一个新名词“ATDD”,全称“Acceptance Test Driven Development ”,中文称“验收测试驱动开发”。ATDD和TDD的区别是什么呢,查了一些资料,个人理解以下:html

先介绍一下TDD,引用Wikipedia上的关于TDD的介绍:ide

Test-driven development (TDD) is a software development process that relies on the repetition of a very short development cycle: first the developer writes an (initially failing) automated test case that defines a desired improvement or new function, then produces the minimum amount of code to pass that test, and finally refactors the new code to acceptable standards.测试

TDD只涉及到Developer(开发者),只能算我的工做方式的改变。而现代软件开发,每每都是“产品经理(或业务)、测试人员(或QA)、开发人员”三者合做的成果,若是开发人员对业务需求理解的不正确,那么写出的测试用例也是错的,这个问题是TDD解决不了的。中文Wikipedia上对于TDD缺点的描述,也把这一问题列在第一位:ui

image

ATDD又如何解决这个问题呢?《Explore It!: Reduce Risk and Increase Confidence with Exploratory Testing》这本书的做者Elisabeth Hendrickson给出了下面的解释:3d

Acceptance Test Driven Development (ATDD) is a practice in which the whole team collaboratively discusses acceptance criteria, with examples, and then distills them into a set of concrete acceptance tests before development begins. It’s the best way I know to ensure that we all have the same shared understanding of what it is we’re actually building. It’s also the best way I know to ensure we have a shared definition of Done.code

整个团队(包括上面提到的三方成员)在开发工做开始以前,一块儿讨论、制定每一个任务(或者用户故事)的验收标准,并提取出一组验收测试用例。这么作好处在于:htm

  1. 你们一块儿讨论验收标准和测试用例保证了对业务需求一致的理解。(这一点实际是全部开发环节中都须要关注的问题
  2. 经过造成测试用例,使标准成为可执行的内容,而不是虚的指标。

国内公司通常项目开发进度很紧,大部分公司开发和测试工做由不一样的人来负责,彻底照搬TDD流程来开发成本太高。我更建议开发人员使用自动化测试技术编写验收测试用例,只要验收测试用例可以跑通了,就能够提交测试。blog

参考:

  1. Test-driven development
  2. 测试驱动开发
  3. BDD就是作得比较好的ATDD吗?
  4. Acceptance Test Driven Development (ATDD): an Overview
  5. 验收测试驱动开发(ATDD)
  6. 【转】TDD和ATDD的转化?
相关文章
相关标签/搜索