Skip to main content
Tool comparison
COMPARE  /  cucumber-vs-plain-test-code

Cucumber vs Plain Test Code

Cucumber runs Gherkin scenarios, written as Given, When, Then, through step definitions in code, so business examples become executable specifications. Plain test code skips that layer and writes tests directly in the runner. Cucumber pays off when product, QA and developers actually write and read the scenarios together; without that collaboration it adds a translation layer and little else.

Cucumber
The tool that runs Gherkin scenarios as executable specifications through step definitions, with official implementations for the JVM, JavaScript, Ruby and more.
Plain test code
Tests written directly in a runner such as JUnit, pytest, Playwright Test or Jest, with helpers and page objects but no natural-language layer.

How do Cucumber and Plain test code compare?

Cucumber vs Plain test code, compared by dimension
What the test looks likeCucumberA .feature file in Gherkin plus step definitions that map each line to codePlain test codeA test function in the runner's language calling helpers or page objects
Who is it forCucumberProduct, QA and developers reading the same examplesPlain test codeThe engineers who write and run the tests
The practice behind itCucumberBDD: discovery, formulation and automation, with living documentation as the outputPlain test codeAny: TDD, test-after, exploratory automation
Cost of a new testCucumberWrite the scenario, then the steps that do not yet exist, keeping wording consistentPlain test codeWrite the test
ReuseCucumberStep definitions shared across scenarios; wording drift creates near-duplicate stepsPlain test codeFunctions, fixtures and page objects shared across tests
DebuggingCucumberFailure points at a Gherkin line, then at the step code behind itPlain test codeFailure points at the test line
Language supportCucumberOfficial Cucumber-JVM, Cucumber-JS, Cucumber-Ruby; Behave, pytest-bdd and Reqnroll semi-officialPlain test codeWhatever runner the language already has
Common failureCucumberGherkin written by testers alone, read by nobody else: a slower way to write plain testsPlain test codeTests only engineers can read, so requirements and tests drift apart silently

When should you choose Cucumber, and when Plain test code?

Choose Cucumber when

  • Product owners or analysts genuinely take part in writing and reviewing the scenarios.
  • Living documentation of behaviour is a deliverable, for example for audit or regulated products.
  • The team already practises BDD discovery sessions and wants the examples to run.
  • Non-engineers need to read test results in the language of the requirements.

Choose Plain test code when

  • Only engineers will ever read the tests.
  • The suite is API, unit or component level, where Gherkin adds no clarity.
  • Speed of writing and debugging tests matters more than a shared vocabulary.
  • The team has tried Cucumber and found the step layer maintained by QA alone.

How does Cucumber vs Plain test code come up in QA interviews?

Every Cucumber interview question is really this question. Interviewers know Gherkin syntax is trivial; they want to know whether you understand that BDD is a collaboration practice, whether you have seen it fail as pure test syntax, and whether you would recommend it for the team in front of you.

  1. 01What is the difference between BDD and using Cucumber, and can you have one without the other?
  2. 02Describe a project where Gherkin earned its keep, and one where it did not. What was different?
  3. 03Your step definitions have 40 near-duplicate steps for logging in. How did that happen and how do you fix it?
  4. 04A team of developers with no product involvement wants to adopt Cucumber. What do you tell them?
Answer 2 Free Questions

No account needed · Scored in under a minute against a senior rubric

Common questions about Cucumber vs Plain Test Code

Is Cucumber a testing tool?

Cucumber runs tests, but its documentation frames BDD as a collaboration practice with three parts: discovery, formulation and automation. The tool automates the examples the team formulated together; if the team skips discovery and formulation, Cucumber becomes a more expensive way to write ordinary tests.

Does Cucumber slow down test automation?

It adds a layer: each scenario line needs a step definition, and wording must stay consistent or steps multiply. That cost is worth paying when non-engineers read the scenarios. When they do not, plain test code in the runner is faster to write, debug and refactor.

Can I use Cucumber with Playwright or Selenium?

Yes. Cucumber-JS pairs with Playwright, and Cucumber-JVM pairs with Selenium in Java, with the browser calls living inside the step definitions. The question is whether the Gherkin layer serves readers who would not read the Playwright or Selenium code.

Should I learn Cucumber for QA interviews?

Learn the Gherkin syntax and the step definition model, because many postings list Cucumber and interviews ask about it. More important is being able to explain when BDD helps and when it does not, with an example, which is what separates a strong answer from a syntax recital.

EXEC.NOW

Ready to be asked about Cucumber or Plain test code?

Practice explaining the trade-off to an interviewer who knows both.

Join 500+ QA engineers already practicing with AssertHired.

Question 1 · Automation · Mid-levellive scoring

A test passes locally but fails in CI about one run in five. Walk me through what you check first, and why.

Scored on the same four dimensions as the real thing: Technical accuracy · Coverage · Clarity · Best practices.

Rather skip ahead? Create a free account

FREE.TO.START  ·  7.DAY.TRIAL ON PAID PLANS
Written by , Senior QA Automation Engineer, 50+ QA candidate interviews conductedLast updated July 2026