Cucumber BDD notes
Feature to be added
-> Optional Text:
-As a
-I want to
-So that
Feature:Brush teeth
As a human being,
I want to brush my teeth
So that they stay pain free
Scenario: Expected outcome title
Steps within scenario
Given: Sets up initial state
When: Perform action(s)
Then: Check end state
(Optional) And/But: after any Given,When,Then sentence
@Tags: Before step definitions
- Feature supersets,
- important
- slow/fast
- w.i.p
- weekly,daily,hourly
- humanexecuted
Data tables in steps; alternative to multiple ‘And’ steps
Colon at end of a step : Each list item inbetween vertical lines |‘s
Given I have the following tools:
| paste |
| brush |
| water |
Scenario Outlines: parse arguments from a list to the same scenario
Variables inside given,when,then steps surrounded by ’< >‘ marks then a list in a column format with the variable header at the top; vertical lines |’s whole way down.
Given I’m using the toothpaste
| brand |
| colgate |
| sensodyne |
Backgrounds/Supports:Setup context before scenarios
Background:
Given I have teeth
And I have toothpaste
Scenario: Successful Brushing
Scenario: Toothpaste runs out
Regular expression notes
Forward slashes / start the notation of a regular expression within a step definition file in front of a Given,When,Then keyword.
Cucumber ignores the Given…* keywords for its automation tests
Escaping characters are done by backslashing special symbols e.g. \$
Arguments are captured by surrounding them in parenthesis marks “( )”
Inside these parenthesis marks, regular expression notations can be used e.g. ( [0..9]* ) or ( \d+)
(?: … ) : ?: means that it’s a noncapturing expression. e.g. (?:visit|go to)