Cucumber – Comments | Code Factory


Donate : Link

Medium Blog : Link

Applications : Link

Cucumber Tutorial Index Page: Link

  • It is basically piece of code meant for documentation not for execution purpose.
  • We can use comment in a step definition or feature file to make more readable and unsderstandable.
  • It is important to use comments at appropriate places in the file.
  • This is also helpful while debugging the code.
  • Cucumber feature files can have comments at any place.
  • To put a comment, we just need to start the statement with ‘#’ sign.
  • Different programming languages have different norms for defining comments, where as in cucumber we can deal with
    • Step Definition: If we are using as a java platform then mark comment with //
    • Feature File: In case of feature file we just need to put # beginning statement.
  • Example
Feature: Login functionality feature
     # Checking Login functionality with valid data
     Scenario: Login functionality with valid data
         Given       User navigate to xyz.com
         When        User enter valid id "user1" and psw "user1"
         Then        Login should be successful

Leave a comment