Getting Started with Gherkin

GherkinLanguage provides a standard approach to describe business requirements (expressed as behaviors) and user acceptance criteria. It is an important part of BehaviorDrivenDevelopment (BDD). Using Gherkin, ProductOwners, QualityEngineers, and SoftwareEngineers can collaborate before development begins to establish a shared understanding of what "success" means.

Scenarios should be simple and short, with each element only appearing one or twice at most, in order, with the following properties:
  • Given: A simple description of the necessary starting state (preconditions). Corresponding glue code should do whatever is necessary to put you in the start state, without verifying anything.
  • When: A single action (e.g. click a button) or series of actions that are substeps for a single abstract operation (e.g., “Go to the Holdings tab under My Wealth”) that a user would perform from the Given start state. Does not verify anything, just (attempts) to do something.
  • Then: A single testable condition that should be true after having performed the When action from the initial Given start state. Should not do anything that changes the app state (i.e., performs an action in the app), only tests against the current state in a read-only fashion.

The entire Scenario, when read aloud, should sound like a coherent (non run-on) sentence.

-- StanVogel - 13 Apr 2020
Topic revision: r1 - 13 Apr 2020, NicoleRadziwill
© 2020 Ultranauts - 75 Broad Street, 2nd Floor, Suite 206, New York, NY 10004 - info@ultranauts.co