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.

Level

Showing 40 of 40 questions

  1. 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…

  2. 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…

  3. 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…

  4. 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…

  5. 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…

  6. 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…

  7. 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…

  8. 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…

  9. 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…

  10. 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…

  11. 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…

  12. 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…

  13. 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…

  14. 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…

  15. 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…

  16. 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…

  17. 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…

  18. 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…

  19. 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…

  20. 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…

  21. 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…

  22. 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…

  23. 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…

  24. 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…

  25. 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…

  26. 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…

  27. 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…

  28. 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…

  29. 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…

  30. 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,…

  31. 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…

  32. 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…

  33. 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…

  34. 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:…

  35. 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…

  36. 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…

  37. 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…

  38. 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…

  39. 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…

  40. 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…