Testing / Karate Framework Interview questions
Explain the execution flow of a Karate scenario from feature file to HTTP response?
When a scenario runs, Karate processes its steps sequentially, building up request state before finally triggering the HTTP call, then applying the assertions that follow.
Steps under Given accumulate request configuration, URL, path segments, headers, query params, and body, into an in-memory request object without sending anything yet. The When method <verb> step is what actually triggers the HTTP call, using everything accumulated so far. Once the response returns, Karate populates built-in variables like response, responseStatus, and responseHeaders, which the following Then steps then assert against.
If any step fails, whether a connection error, an unexpected status, or a failed match, the scenario stops immediately and is marked failed, with the remaining steps in that scenario skipped rather than executed.
More Related questions...