Comments

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

Comments start with a # character and 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​​​
 
And ​I withdraw $100​​
 
Then ​I ...

Get The Cucumber for Java 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.