Saturday, May 16, 2026

Gherkin Syntax

Gherkin Syntax: Structured format (Given/When/Then) for defining behavior.

Gherkin is a plain-text language with a simple structure. It is designed to be easy to learn by non-programmers, yet structured enough to allow concise description of test scenarios and examples to illustrate business rules in most real-world domains.

Here is a sample Gherkin document:

Feature: Account Holder withdraws cash

Scenario: Account has sufficient funds

    Given The account balance is $100

      And the card is valid

      And the machine contains enough money

     When the Account Holder requests $20

     Then the ATM should dispense $20

      And the account balance should be $80

      And the card should be returned

source: https://support.smartbear.com/cucumberstudio/docs/bdd/write-gherkin-scenarios.html

Reference: https://cucumber.io/docs/gherkin/reference/


No comments:

Post a Comment