skip to content

Cucumber & BDD Automation

The tool family that turns Gherkin scenarios into executable tests: feature files, step definitions and living docs across the JVM, JS, Python and .NET. SDET specs name it, so interviewers probe it.

on this pageshow

explore

questions

page 2 of 2

In a parallel Cucumber-JVM run, what goes wrong when step definitions keep scenario state in a static field?

level: seniorimportance: should knowfreq 54%

basics

~10 s

A static field is one slot per class for the whole JVM, so concurrent scenarios read and write the same value. Scenarios overwrite each other's data, and the failure passes when rerun alone.

open as a page

How do you register a custom Cucumber Expression parameter type, and where must that registration live?

level: seniorimportance: should knowfreq 44%

basics

~20 s

Register it in code the runner already loads with your step definitions: in Cucumber-JVM a method annotated @ParameterType, in cucumber-js a defineParameterType call in a support file. The name then becomes a placeholder that converts matched text into a domain object.

open as a page

A Cucumber-JVM pack outgrew the pipeline budget — how do you choose between tag tiering, parallelism and sharding?

level: principalimportance: should knowfreq 44%

basics

~20 s

Measure per-scenario durations first, then decide what each pipeline stage must gate. Tag tiering buys speed by covering less, in-JVM parallelism buys it by demanding isolated glue, and sharding across agents buys it with infrastructure and result aggregation.

open as a page

Several teams read one Cucumber suite's report - how do you decide between a bundled formatter and building on the Messages stream?

level: principalimportance: should knowfreq 28%

basics

~20 s

Start from the audience and the decision the report drives. Bundled formatters and tag-filtered runs cover most multi-team needs for free. Build on the message stream only when history, merging or per-team slicing survives those cheaper options.

open as a page

What does the # language: header at the top of a Cucumber feature file change, and what breaks when it is missing?

level: middleimportance: nice to knowfreq 19%

basics

~20 s

The header selects the Gherkin dialect for that one file, changing only the keywords the parser accepts. Step text and step definitions are untouched. Without it the parser assumes English, so localized keywords fail to parse.

open as a page

In Cucumber-JVM, how does the order attribute sequence @Before hooks, and which way do @After hooks run?

level: middleimportance: nice to knowfreq 26%

basics

~20 s

Cucumber-JVM runs @Before hooks in ascending order value, lowest first, and @After hooks in descending order, highest first, so teardown unwinds setup in reverse. Hooks that leave order unset share one default and have no guaranteed sequence.

open as a page

How do Cucumber-JVM's TestNG base class and CLI runner differ from a JUnit Platform suite?

level: middleimportance: nice to knowfreq 31%

basics

~20 s

AbstractTestNGCucumberTests feeds scenarios to one inherited test method through a data provider, so results arrive as repeated invocations. The command-line runner is not a test framework at all: it returns an exit code the build must interpret.

open as a page

In Cucumber-JVM, how does a doc string's content type reach a @DocStringType transformer?

level: middleimportance: nice to knowfreq 24%

basics

~20 s

Write the content type immediately after the doc string's opening delimiter in the feature file. Cucumber-JVM pairs it with the step method's declared parameter type to select a @DocStringType transformer. With none registered, the body arrives as a plain String.

open as a page

What does Cucumber's --publish option actually do, and what do you give up by turning it on?

level: middleimportance: nice to knowfreq 23%

basics

~20 s

--publish uploads the run's message stream to Cucumber's hosted reports service and prints a link to the rendered report. In exchange, run data leaves your network, anyone holding the link can read it, and the run gains a network dependency.

open as a page

In Cucumber-JVM with Spring, what does @CucumberContextConfiguration mark and why may only one class carry it?

level: middleimportance: nice to knowfreq 36%

basics

~20 s

@CucumberContextConfiguration marks the single glue class that tells cucumber-spring how to bootstrap the Spring test context. Exactly one entry point is allowed, so a second annotated class fails the run at startup. Step definition classes then become injectable Spring beans.

open as a page

Why do Cucumber Expressions offer optional text like hour(s) and alternation like logs/records?

level: middleimportance: nice to knowfreq 30%

basics

~20 s

Parentheses make text optional and a slash alternates the words around it, so one Cucumber Expression covers several wordings. The same parentheses in a regular expression would be a capture group demanding another method argument; in an expression they capture nothing.

open as a page

When does a broad Cucumber step expression stop being reuse and become accidental capture?

level: seniorimportance: nice to knowfreq 31%

basics

~20 s

Reuse is two steps meaning the same action with a different value. Capture is one loose expression being the only match for a step it was never written for - Cucumber says nothing and the step passes wrongly.

open as a page

How do you decide which Cucumber implementations a polyglot organisation should support?

level: principalimportance: nice to knowfreq 26%

basics

~20 s

Match each service to the implementation native to its language rather than mandating one estate-wide. Glue calls production code, so an out-of-stack choice buys shared tooling at the cost of a language boundary. Standardise conventions and reporting instead.

open as a page

showing 31–43 of 43