Comments

As well as the description fields that follow Feature and Scenario keywords, Cucumber allows you to precede these keywords with comments.

Like in Ruby, comments start with a # character. Unlike in Ruby, comments have to be the first and only thing on a line (well, apart from whitespace).

Here’s an example:

gherkin_basics/comments_example.feature
 
# This feature covers the account transaction and hardware-driver modules​​​
 
Feature:​ Withdraw Cash
 
In order to buy beer
 
As an account holder
 
I want to withdraw cash from the ATM
 
 
# Can't figure out how to integrate with magic wand interface​​​
 
Scenario:​ Withdraw too much from an account in credit​​
 
Given ​I have $50 in my account
 
# When I wave my magic wand​​​

Get The Cucumber Book now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.