TDD, ATDD and BDD

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/cjqh_hao/article/details/82809881

几种常见的敏捷开发模式(Agile Software Development)介绍

TDD
Test-Driven Development(测试驱动开发),从测试的角度来检验整个项目。大概的流程是先针对每个功能点抽象出接口代码,然后编写单元测试代码,接下来实现接口,运行单元测试代码,循环此过程,直到整个单元测试都通过

ATDD
Acceptance Test-Driven Development (验收测试驱动开发),通过单元测试用例来驱动功能代码的实现,需要定义出期望的质量标准和验收细则,以明确而且达成共识的验收测试计划(包含一系列测试场景)来驱动开发人员的TDD实践和测试人员的测试脚本开发。面向开发人员,强调如何实现系统以及如何检验。

BDD
Behavior-Driven Development(行为驱动开发),BDD将产品功能简单和自然化,用自然语言来描述,让开发、测试、BA以及客户都能在这个基础上达成一致,是对ADD的补充。

实际工作中都应接触到了这几种模式,只是并不是那么规范;比如单元测试,相信很多人都写过,我认为敏捷开发模式虽然分多种,也是从不同的角度是说明问题,但最终强调的是:做正确的事,做规范的事,不做重复的事。

下面是引用的第一篇文章TDD and BDD Differences的观点,观点很好,值得读一下。

I honestly don't see the difference between BDD and TDD.
That's because there isn't any.
I mean, both are just tests if what is expected happens.
That's wrong. BDD and TDD have absolutely nothing whatsoever to do with testing. None. Nada. Zilch. Zip. Nix. Not in the slightest.

Unfortunately, TDD has the word "test" in pretty much everything (not only in its name, but also in test framework, unit test, TestCase (the class you tpyically inherit from), FooTest (the class which typically holds your tests), testBar (the typical naming pattern for a test method), plus a lot test-related terminology such as "assertion" and "verification") which leads some people to believe that it actually does have something to do with tests. So, some smart people said: "Hey, let's just change the name" to remove any potential for confusion.

And that's what BDD is. It's just TDD with any test-related terminology replaced by examples-of-behavior-related terminology:

Test → Example
Assertion → Expectation
assert → should
Unit → Behavior
Verification → Specification
… and so on
BDD is just TDD with different words. If you do TDD right, you are doing BDD. The difference is that – provided you believe at least in the weak form of the Sapir-Whorf Hypothesis – the different words make it easier to do it right.

By Jörg W Mittag
BDD is from customers point of view and focuses on excpected behavior of the whole system.
TDD is from developpers point of view and focuses on the implementation of one unit/class/feature. It benefits among others from better architecture (Design for testability, less coupling between modules).
From technical point of view (how to write the "test") they are similar.

I would (from an agile point of view) start with one bdd-userstory and implement it using TDD.

By k3b

参考文档
https://stackoverflow.com/questions/4395469/tdd-and-bdd-differences
https://www.cnblogs.com/lcw/p/4059291.html

猜你喜欢

转载自blog.csdn.net/cjqh_hao/article/details/82809881
bdd
TDD
今日推荐