A comment is fundamentally a piece of code meant for documentation purposes and not for execution. To make Feature File and Step Definition File more readable and understandable. It is essential to use comments at appropriate places in the file. The Comment also helps while debugging the code.
In Java, we have Single Line, Multi-Line, and Documentation Comment. You can use these types of comments in your step definition file because your step definition file is written in Java, but in the Feature file, we can not use all these types of comments.
How to comment in the feature file
Cucumber feature files can have comments at any place. We need to start the statement with the "#" sign to put Comments. Feature file only supports comments with a # sign. We put # at the beginning of our Comment. You want to do a single line or multiple line comments; you need to put # before all lines. The parser will ignore every line which starts with #.
How to comment multiple lines in the feature file
To comment multi-line or use block comment, select all the lines and press shortcut
- Ctrl + / in Windows Eclipse
- Command + / in Mac Eclipse
Other IDE may have other shortcuts for doing this. Similarly to remove comment press Ctrl + / again.