Feature

Each Gherkin file begins with the Feature keyword. This keyword doesn’t really affect the behavior of your Cucumber tests at all; it just gives you a convenient place to put some summary documentation about the group of tests that follow.

Here’s an example:

 
Feature:​ This is the feature title
 
This is the description of the feature, which can
 
span multiple lines.
 
You can even include empty lines, like this one:
 
 
In fact, everything until the next Gherkin keyword is included
 
in the description.

The text immediately following on the same line as the Feature keyword is the name of the feature, and the remaining lines are its description. You can include any text you like in the description except a line beginning with one of the words Scenario, Background, or Scenario Outline. The description can span multiple lines. It’s a great place to wax lyrical with details about who will use the feature, and why, or to put links to supporting documentation such as wireframes or user research surveys.

It’s conventional to name the feature file by converting the feature’s name to lowercase characters and replacing the spaces with underscores. So, for example, the feature named User logs in would be stored in user_logs_in.feature.

In valid Gherkin, a Feature must be followed by one of the following:

  • Scenario

  • Background

  • Scenario Outline

Although Background and Scenario Outline are handy keywords to know once you’ve written a few scenarios, we don’t need to worry about them just yet. They’re covered later in Chapter 5, Expressive Scenarios. Right now all we need is the Scenario.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.37.154