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

  1. Feature supersets,
  2. important
  3. slow/fast
  4. w.i.p
  5. weekly,daily,hourly
  6. 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


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)


Just enough regular expressions for cucumber


Now read this

Pluralsight - Clean Code: Writing Code for Humans course notes part 1

Resources Code Complete 2 Clean Code The Pragmatic Programmer Conventions Comparisons vs Snippets Verbalize Code. Literal reading code Three Principles for Clean Code 1) Right tool for the job: Less logic code required Learn multiple... Continue →