Karate framework interview questions
// 40 QUESTIONS · UPDATED MAY 2026
Karate framework interview questions covering the BDD-style DSL, scenarios, embedded JavaScript, JSON path operations, parallel runner, Karate Mock Server, and the integrated performance testing capabilities via Karate Gatling.
Showing 40 of 40 questions
- What makes Karate different from REST Assured?Junior
Karate is a BDD DSL where tests are written in plain-text .feature files without Java code; REST Assured is a Java fluent API. Karate bun…
- Explain how Karate's `* def` and `* match` work in a scenario.Mid
`* def` assigns a value to a named variable in the current scenario scope; `* match` asserts equality or structure. Together they are Kar…
- Walk through the structure of a basic Karate .feature file.Junior
A .feature file starts with Feature: followed by an optional description, then one or more Scenario: blocks. Each scenario contains Given…
- What is the difference between Background and Scenario in Karate?Junior
Background runs its steps before every Scenario in the feature file — use it for shared setup like setting the base URL, defining auth he…
- How do you assert on a JSON response field in Karate?Junior
Use * match response.fieldName == 'expected' for a single field, or * match response == { id: '#number', name: 'Alice' } for the whole bo…
- How do you parameterise a Karate scenario with multiple datasets?Junior
Use Scenario Outline: with an Examples: table — column headers become variables available as <columnName> in steps. Karate runs the scena…
- How does Karate handle authentication (e.g. bearer token in headers)?Junior
Set a header variable in Background with * def authHeader = { Authorization: 'Bearer ' + token } and apply it with And headers authHeader…
- What's the difference between `match ==` and `match contains` in Karate?Junior
match == requires exact equality — every field in the response must match and no extra fields are allowed. match contains checks that the…
- How does Karate's embedded JavaScript work? Give a real example.Mid
Any expression inside karate.call('classpath:script.js') or a * def using a JS expression runs in a Nashorn/GraalVM JavaScript context. K…
- What is a Karate feature reference (call read('classpath:...')) and when is it useful?Mid
call read('classpath:path/to/feature.feature') executes another feature file inline and returns its exported variables as a map. Pass arg…
- How do you reuse logic across scenarios with Karate (helpers and library features)?Mid
Extract common steps into a helper feature under helpers/ and call it with * def result = call read('classpath:helpers/create-user.featur…
- How does Karate handle JSON schema validation differently from REST Assured?Mid
Karate's # markers (#string, #number, #uuid, #regex, #present, #notnull) do inline structural validation without an external file. REST A…
- Explain how `* match each` works for validating arrays of objects.Mid
* match each arrayVariable == pattern asserts that every element of the array satisfies the pattern. The pattern can use any # wildcard m…
- How do you handle dynamic dates and timestamps in Karate assertions?Mid
For format validation, use * match response.createdAt == '#string' or a regex: '#regex \\d{4}-\\d{2}-\\d{2}.*'. For value-relative checks…
- How does the Karate parallel runner work? What's the unit of parallelism?Mid
Karate's parallel runner (Runner.path().parallel(threadCount).execute()) runs feature files concurrently — the unit of parallelism is the…
- How do you integrate Karate with JUnit 5? What changes in CI?Mid
Use the @Karate.Test annotation on a class with a @Test method that calls Runner.path().parallel(n).execute(). JUnit 5 discovers it norma…
- Compare Karate's Mock Server to WireMock — when would you choose each?Mid
Karate Mock Server is in-process (same JVM) and stubs responses using feature files — ideal when tests and mock co-locate. WireMock runs…
- How would you mock a third-party dependency in a Karate test?Mid
Start a Karate Mock Server on a known port before the suite, configure your service under test to call that port via karate-config.js or…
- How do you structure a Karate project (folders, naming, configuration files)?Mid
Place the JUnit runner in src/test/java. Under src/test/resources: karate-config.js at root for environment config, feature files grouped…
- How do you handle environment-specific configuration in Karate (karate-config.js)?Mid
karate-config.js is evaluated before every feature. It reads karate.env (set with -Dkarate.env=staging) and returns a config object whose…
- How do you handle file uploads in Karate?Mid
Use the multipart keyword: * multipart file = { read: 'classpath:files/test.csv', filename: 'data.csv', contentType: 'text/csv' } followe…
- How does Karate handle SSL/TLS issues for testing?Mid
Add configure ssl = true in karate-config.js to skip SSL certificate validation for self-signed certs. For mutual TLS, use configure ssl…
- How would you debug a Karate scenario that fails with a confusing match error?Mid
Karate's match failure shows the actual vs expected diff with the exact path that failed. Add * print response to log the raw response be…
- Walk through how Karate generates HTML reports and what's actionable in them.Mid
Karate writes an HTML report to target/karate-reports after each run. The summary index shows total pass/fail counts, timing, and thread…
- How would you parametrise the same scenario over a Karate Examples: block?Mid
Use Scenario Outline: with Examples: — column headers become <placeholder> variables substituted into steps. Each row produces one indepe…
- How would you architect a Karate framework for a microservices team?Senior
Organise feature files by service domain under a shared test repository. Use karate-config.js to route baseUrl per service via environmen…
- How do you handle test data setup and teardown across Karate scenarios?Senior
Call a create-resource.feature helper in Background (or at the top of each scenario) to POST test data and capture IDs. Clean up with a d…
- How would you integrate Karate with CI (Jenkins, GitHub Actions) including parallel execution?Senior
Set karate.env via environment variable (GitHub Actions env: or Jenkins withEnv), run mvn test, and publish target/karate-reports as an a…
- Explain how Karate Gatling integrates performance testing with the same feature files.Senior
Add the karate-gatling dependency and create a Gatling simulation that references existing .feature files via KarateProtocol. The same Ka…
- What are the tradeoffs of using embedded JavaScript heavily vs keeping logic in the feature DSL?Senior
DSL-only features are readable by non-engineers and stable across Karate versions. Heavy JavaScript embeds make features harder to read,…
- How would you handle complex OAuth 2.0 / OIDC flows in Karate?Senior
Write a login.feature that POSTs to the token endpoint for client credentials, extracts access_token, and returns it. Call it with karate…
- How do you handle WebSockets in Karate?Senior
Use * def ws = karate.webSocket(url, messageHandler) to open a connection, ws.send(message) to send frames, and karate.listen(timeout) to…
- How does Karate's parallel runner avoid shared-state issues, and where can it still break?Senior
Karate isolates Karate variables per thread — scenarios in the same feature always run sequentially on one thread; different features run…
- How would you migrate from a hand-rolled REST Assured suite to Karate incrementally?Senior
Run both suites against the same environment — they must agree on every endpoint before any deletion. Port one service domain at a time:…
- How do you handle backwards compatibility testing with Karate (e.g. v1 vs v2 API)?Senior
Organise v1 and v2 tests in separate folders, set baseUrlV1 and baseUrlV2 in karate-config.js. Run both suites in CI against the live API…
- Compare Karate's match DSL to JSON Schema. Which is better for what?Senior
Karate's match is concise and co-located with the test — ideal for fast iteration on API-specific contracts. JSON Schema is verbose but p…
- How would you handle test execution speed in a 500+ feature Karate suite?Senior
Profile with the timeline report to find slow feature files. Increase parallel thread count incrementally and measure. Extract expensive…
- How would you build a custom Karate plugin or extend the DSL? What's the extension boundary?Senior
Karate exposes HttpClientFactory to replace the HTTP client entirely and PerfEvent for custom metrics hooks. For custom logic, write a Ja…
- How would you justify Karate's BDD-style DSL to engineers used to writing tests in Java/JS code?Lead
Karate scenarios are 5-10 lines versus 20-40 lines of equivalent Java — lower maintenance overhead. Non-Java stakeholders can read and re…
- How do you onboard a team that's never worked with a BDD framework before?Lead
Start with a working example suite so the team can run and modify before they write. Pair on the first feature file — Given/When/Then tra…