094-Behavior-Driven-Development BDD行为导向开发 Writing Scenarios 编写场景
BDD简介
What is BDD
BDD is about understanding, documenting and verifying
business requirements
through illustrative examples
BDD activities
Basic Example
如果我们要写一个关于scoring system的Scenario场景
Scenario: Correct easy answer scores 10
Given I register a team
When I submit a correct easy answer
Then my score should be 10
这些场景是
1.illustration for the requirements
2.documentation of the behaviors
3.automated tests
Good BDD Scenarios
Fixing mechanics-focused scenarios
Example举例:
Scenario: Question Test
When I check the home page
Then the title should be 'Home'
Given I have logged in
When I ask a new question ...
Small and focused scenarios are much better!