Gherkin is the plain-text, keyword-driven language Cucumber reads. Its core keywords are Feature, Scenario, Given, When, Then, And, But, Background, and Scenario Outline/Examples.
A feature file starts with Feature: (a high-level description), contains one or more Scenario: blocks, and each scenario has steps beginning with Given (context/arrange), When (action/act), Then (outcome/assert), plus And/But to add steps of the same type. Gherkin is indentation-friendly and business-readable. Keywords are just markers — Cucumber matches the TEXT after them to step definitions, so Given/When/Then are interchangeable at the matching level but should be used semantically. Comments start with #, and tags (@smoke) sit above features/scenarios. Writing clear, declarative Gherkin is a skill that determines whether the specs stay readable.
Feature: Login\n Scenario: Successful login\n Given the user is on the login page\n When they enter valid credentials\n Then they land on the dashboard — a readable, executable spec.
In Gherkin, what's the semantic role of Given, When, and Then, and does Cucumber technically enforce the difference?