Parsing Names
Learn how to parse names using the Gherkin parser class.
We'll cover the following
Parsing names
Many Gherkin structures, such as features and scenarios, contain a name. We will focus on features for this section, but the method we develop will apply to all Gherkin structures with names. Let’s consider the following example line:
Feature: The feature name
The piece of text we want to extract from our line is The feature name
. We can do this relatively simply if we remove the Feature:
part at the beginning. Our name parsing method could be implemented like so:
Get hands-on with 1400+ tech skills courses.