Testing / Cucumber Interview Questions
Why does Cucumber require step definitions while Karate doesn't?
Cucumber is a general-purpose BDD engine: it makes no assumptions about what domain a scenario is testing, an API, a UI, a batch job, a piece of business logic entirely unrelated to HTTP, so it has no built-in vocabulary for any of them. Every single step, however common, has to be explicitly implemented because Cucumber genuinely doesn't know what "the customer adds an item to the cart" means without code telling it.
Karate takes the opposite trade-off: by constraining itself specifically to HTTP API testing (and, as an extension, UI and mock testing), it can ship a fixed, built-in vocabulary of steps like url, path, method, and match that already know how to build requests and assert on JSON, so there's nothing left for a test author to implement for those common cases.
This is a genuine trade-off, not a strict improvement in either direction: Cucumber's domain-agnostic design means it can express literally any kind of behavior a team can write step definitions for, while Karate's narrower, purpose-built vocabulary means faster authoring for API/UI tests specifically, at the cost of not being a general BDD framework for arbitrary domains the way Cucumber is.
More Related questions...