Testing / Cucumber Interview Questions
What are Cucumber Expressions?
Cucumber Expressions are a simpler, more readable alternative to regular expressions for matching step text and extracting parameters, using a small set of built-in parameter types like {string}, {int}, and {word} instead of regex syntax.
// Cucumber Expression @Given("a registered user {string} with password {string}") // Equivalent regular expression @Given("^a registered user "([^"]*)" with password "([^"]*)"$")
Beyond readability, Cucumber Expressions support custom parameter types, letting a team register a domain-specific type once (like {color} matching only a fixed set of valid color names, or {user} automatically resolving a username string into a full User object) and reuse it across many step definitions, which regex alone can't express as cleanly. Regular expressions remain fully supported for cases needing pattern matching Cucumber Expressions don't directly cover.
More Related questions...