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 pageshowhide
explore
- Gherkin Syntax & Feature Files4 questions
- Scenario Outlines & Data Tables5 questions
- Step Definitions & Expressions5 questions
- Hooks, Tags & Execution Control5 questions
- State Sharing & Dependency Injection4 questions
- Cucumber-JVM & Runner Integration6 questions
- cucumber-js, Behave & SpecFlow/Reqnroll5 questions
- Reporting & Living Documentation5 questions
- Scenario Design & Anti-Patterns4 questions
questions
page 2 of 2In a parallel Cucumber-JVM run, what goes wrong when step definitions keep scenario state in a static field?
basics
~10 sA 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.
How do you register a custom Cucumber Expression parameter type, and where must that registration live?
basics
~20 sRegister 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.
A Cucumber-JVM pack outgrew the pipeline budget — how do you choose between tag tiering, parallelism and sharding?
basics
~20 sMeasure 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.
Several teams read one Cucumber suite's report - how do you decide between a bundled formatter and building on the Messages stream?
basics
~20 sStart 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.
What does the # language: header at the top of a Cucumber feature file change, and what breaks when it is missing?
basics
~20 sThe 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.
In Cucumber-JVM, how does the order attribute sequence @Before hooks, and which way do @After hooks run?
basics
~20 sCucumber-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.
How do Cucumber-JVM's TestNG base class and CLI runner differ from a JUnit Platform suite?
basics
~20 sAbstractTestNGCucumberTests 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.
In Cucumber-JVM, how does a doc string's content type reach a @DocStringType transformer?
basics
~20 sWrite 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.
What does Cucumber's --publish option actually do, and what do you give up by turning it on?
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.
In Cucumber-JVM with Spring, what does @CucumberContextConfiguration mark and why may only one class carry it?
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.
Why do Cucumber Expressions offer optional text like hour(s) and alternation like logs/records?
basics
~20 sParentheses 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.
When does a broad Cucumber step expression stop being reuse and become accidental capture?
basics
~20 sReuse 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.
How do you decide which Cucumber implementations a polyglot organisation should support?
basics
~20 sMatch 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.
showing 31–43 of 43