📜  软件工程中BDD与TDD之间的区别

📅  最后修改于: 2021-08-25 17:59:31             🧑  作者: Mango

1.行为驱动开发(BDD):
行为驱动开发(BDD)是一种开发技术,其重点更多地放在软件应用程序/产品功能的实现上。主要是因为它创建了一个可执行的规范,因为相应的功能不存在,该规范失败了,然后编写最简单的代码使该规范通过,结果我们在系统中实现了所需的行为。实际上,这是开发人员参与其中的一种开发实践。

BDD的过程:

  1. 编写应用程序的行为
  2. 编写自动化脚本
  3. 然后实施功能代码
  4. 检查该行为是否成功,如果不成功,则修复它
  5. 整理代码(可选)
  6. 重复执行其他操作的步骤

2.测试驱动开发(TDD):
测试驱动开发(TDD)是一种开发技术,它更多地关注软件应用程序的行为。主要是指编写失败的测试用例,因为指定的功能不存在,并且在此之后更新了可以使测试用例通过的代码,因此我们在系统中实现了该功能。实际上,这是一种涉及开发人员,客户,质量保证人员的团队方法。

TDD的过程:

  1. 添加测试用例
  2. 运行测试用例,观察测试失败
  3. 更新代码
  4. 再次运行测试用例
  5. 重构代码(可选)
  6. 对另一个测试用例重复这些步骤

BDD与TDD之间的差异:

S.NO.

Behavior Driven Development

Test Driven Development

01. Behavior Driven Development is a development technique which focuses more on the implementation of a feature of a software application/product. Test Driven Development is a development technique which focuses more on a software application’s behavior.
02. In BDD the participants are Developers, Customer, QAs. In TDD the participants are developers.
03. Mainly it creates an executable specification that fails because the respective feature doesn’t exist, then writing the simplest code that can make the specification pass and as a result we get the required behavior implemented in the system. Mainly it refers to write a test case that fails because the specified functionality doesn’t exist and after that update the code that can make the test case pass and as a result we get the feature implemented in the system.
04. Its main focus is on unit test. Its main focus is on system requirements.
05. In BDD the starting point is a scenario. In TDD the starting point is a test case.
06. It is a team methodology. It is a development practice.
07. Here language used to write behavior/scenarios is simple English language. Here language is used is similar to the one used for feature development like programming language.
08. In BDD collaboration is required between all the stakeholders. In TDD collaboration is required only between the developers.
09. It is a good approach for project development which are driven by user actions. It is a good approach for projects which involve API and third-party tools.
10. Some of the tools used are  Cucumber, Dave, JBehave, Spec Flow,  Concordian, BeanSpec etc. Some of the tools used are  JBehave, JDave, Cucumber, Spec Flow, BeanSpec, FitNesse etc.