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

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)


Resource


Just enough regular expressions for cucumber

 
0
Kudos
 
0
Kudos

Now read this

Thoughtbot trail - Unix

You can use these commands and operators: ** |, <, >, >>, &, ack, awk, cat, chmod, chown, cp, export, find, kill, locate, ls, mkdir, mv, ps, rm, sed, sort, tail, top, vim, whereis, xargs.** Found an awesome index... Continue →