Behavior
What is BDD?
BDD is a refinement of the Agile process, not an overhaul.
True
Advantages of BDD (part 1):
Advantages of BDD (part 2):
Advantages of BDD (part 3):
Advantages of BDD (part 4):
What types of tests are BDD best suited for?
- E.g., testing APIs and web UIs
What types of tests is BDD NOT well-suited for?
- Not good for performance tests, which rely on metrics instead of pass/fail results
Gherkin
domain-specific language for writing BDD scenarios whose language standard is maintained by Cucumber (a prevalent BDD automation framework)
Gherkin scenario structure:
Given-When-Then
Given some initial state, when an action is taken, then verify an outcome
Gherkin Features
Gherkin Scenarios
How to write good steps:
Good steps are declarative - states what should happen at a high-level
Not imperative - shouldn’t focus on direct, low-level instructions
In a scenario, each type of step is optional.
True
In a scenario, step order matters.
True
Scenarios are dependent on each other to run.
False. Each scenario runs independently.
Additional steps that can be added to Given, When, or Then:
- But: functions the same as And, but might be easier to read. Interchangeable with And.
Gherkin: And
Gherkin: Background
How do you denote parameter names in Gherkin?
< >
Scenario outlines may have multiple Examples tables.
True
What are Examples?
Gherkin Keywords: | (pipe character)
- use the escape sequence “|” to use pipe characters as text within a column