Test automation · BDD · QA · Agile

BDD and Cucumber: When Gherkin Scenarios Help and When They Hurt

The benefits of behaviour-driven development and Gherkin scenarios with Cucumber, the common traps, what makes a good scenario, and when BDD is worth it.

Sander Yazıcıoğlu Published: 2 min read Türkçe oku

BDD and Cucumber: When Gherkin Scenarios Help and When They Hurt

Working on test automation platforms, BDD was one of the most debated topics: some teams had built a great shared language with the business through Gherkin, others were drowning in hundreds of "Given-When-Then" files nobody read. The difference wasn't the tool; it was how it was used.

BDD isn't really a testing tool

Behaviour-Driven Development means the business, developers and testers talking through examples before a feature is built. Cucumber and Gherkin turn the output of that conversation into something executable. Without the conversation, Gherkin is just an extra layer on top of test code.

A good scenario

Feature: Cancelling a test run

  Scenario: A running test run is cancelled by the user
    Given I have a test run in progress on a "Pixel 8"
    When I cancel the run
    Then the run status is "Cancelled"
    And the device becomes available again within 30 seconds

What makes it good:

  • Business language: no UI details like "click the button" or "find the element with id x".
  • One behaviour: the scenario describes one rule.
  • Concrete examples: "Pixel 8" rather than "a device", "30 seconds" rather than "quickly".
  • Short: 3–7 steps. Long scenarios usually mix several behaviours.

A bad scenario

Given I open the login page
And I type "[email protected]" into the "email" field
And I type "123456" into the "password" field
And I click the "Login" button
And I wait 3 seconds
...

This isn't a scenario; it's a test script translated into English. It breaks whenever the UI changes, means nothing to the business, and step definitions multiply out of control.

Benefits

  • A shared language: "what happens when a run is cancelled?" gets answered before any code is written, and misunderstandings surface early.
  • Living documentation: scenarios run on every build, so they stay current.
  • Acceptance criteria: the "done" definition of a user story becomes concrete.

Common traps

  1. Only QA writes scenarios: without the shared conversation, BDD's main benefit disappears.
  2. Step definition explosion: hundreds of similar but differently worded steps. Keep a step glossary and prefer parameterised steps.
  3. Testing everything through the UI: a Gherkin scenario can run against an API or service layer too. Verify behaviour at the cheapest layer; I describe the test pyramid in the mobile test automation strategy.
  4. Scenarios that depend on each other: each scenario should set itself up with its own Given steps.

When is it worth it?

SituationBDD / Cucumber
Complex business rules, business actively involvedGreat fit
Regulation, audits, acceptance documents requiredGood fit
Technical team writing tests for itself, no other readersUnneeded layer
Small, fast-changing prototypeA burden

Conclusion

BDD's value isn't in the Gherkin files but in the conversation that produces them. Short scenarios written with the business, in business language, create a strong shared language; UI scripts written by QA alone turn into maintenance debt.

Flaky Appium Tests: 8 Root Causes and Lasting Fixes

December 2, 2026 · 3 min read

Flaky Appium Tests: 8 Root Causes and Lasting Fixes

The eight most common reasons Appium tests pass one run and fail the next, from timing and selectors to device state and test data, and how to fix them for good.

AppiumTest automationMobileQA

All articles →