☰ See All Chapters |
Comments in Cucumber
Gherkin supports single line comments and no multiline comments. Comments should start from # character.
Comments can be put anywhere in feature file, starting from # character till the end of the line will be considered as comment.
Example
# This is a comment
Feature: Login
# This is a comment
Scenario: Successful Login to the page
Given I open Chrome browser
# This is a comment
# This is a comment
And I navigate to login page
But I navigate to login page in a new tab
When I click on login option
# This is a comment
When I provide username as "manu.m@tools4testing.com" and password as "*****"
But Username should be Email
When I click on login button
Then Login success window should be displayed
Then Login success window should welcome me
But Login success window should be a pop up
# This is a comment
Cucumber features can be written by any spoken language of your customer and not just limited to English. It can be written in language like German, French, Kannada, Dutch etc…
If language other than English is used then put a # language: comment on the first line of a feature file. Below is an example for feature written in Kannada language.
# language: no
Feature: ಲಾಗಿನ್ ಮಾಡಿ
Scenario: ಪುಟಕ್ಕೆ ಯಶಸ್ವಿ ಲಾಗಿನ್
Given ನಾನು ಬ್ರೌಸರ್ ತೆರೆಯುತ್ತೇನೆ
When ನಾನು ಲಾಗಿನ್ ಪುಟಕ್ಕೆ ನ್ಯಾವಿಗೇಟ್ ಮಾಡುತ್ತೇನೆ
Then ಲಾಗಿನ್ ಪುಟವನ್ನು ಪ್ರದರ್ಶಿಸಬೇಕು
All Chapters