BDD引擎的比较

BDD的开发模式跟TDD类似,但是测试的层次较高,不在unit level, 而在story level,端到端的测试。BDD的实现,大多基于Gherkin的语法(语法来自于Cucumber), 但是还有其他的框架也是实现了这个语法。下面简单介绍了Gherkin和各种语言的BDD引擎。

Behavior Driven Development (which we will now refer to as “BDD”) follows on from the ideas and principles introduced in Test Driven Development. The key points of writing tests before code really apply to BDD as well. The idea is to not only test your code at the granular level with unit tests, but also test your application end to end, using acceptance tests.

Gherkin Syntax

Acceptance tests usually make use of the Gherkin Syntax, introduced by the Cucumber Framework, written for Ruby. The syntax is quite easy to understand, and, in the Freshen Python package, makes use of the following eight keywords to define your features and tests:

  • Given
  • When
  • Then
  • And
  • Feature:
  • Background:
  • Scenario:
  • Scenario Outline:

Below, you can review these keywords in action, and how they can be used to structure your acceptance tests.

BDD Engine

Cucumber is not the only engine supporting natural language instructions. It’s just one implementation of natural language instructions interpreter. The actual language to write tests with is called Gherkin. And it has different implementations adopted to different programming language. Thus we have:

详细比较参见http://mkolisnyk.blogspot.com/2012/06/gherkin-bdd-engines-comparison.html

Print Friendly

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>