...

/

Implementing Our Gherkin Parser: Parsing a Single Scenario

Implementing Our Gherkin Parser: Parsing a Single Scenario

Learn about parsing a single scenario within the Gherkin parser class.

Parsing a single scenario and background

We will now work to parse a single Gherkin scenario and background structure. We will do this together because Gherkin’s backgrounds are similar to scenarios. If we look at the given example below, we can see that the two are structurally identical:

Press + to interact
Feature: Multiple site support
Only blog owners can post to a blog, except administrators,
who can post to all blogs.
Background:
Given a global administrator named "Greg"
And a blog named "Greg's anti-tax rants"
And a customer named "Dr. Bill"
And a blog named "Expensive Therapy" owned by "Dr. Bill"
Scenario: Dr. Bill posts to his own blog
Given I am logged in as Dr. Bill
When I try to post to "Expensive Therapy"

However, remember that during our data modeling process, we created two different PHP classes to represent these structures. Because these ...