README 主体已迁移到 docs.karatelabs.io,旧版完整说明需查看 v1.5.2.RC2 标签;v2 存在模块与迁移变化,需先读 README_V2.md
karate
karatelabsMIT活跃维护用一套简洁的 DSL 同时搞定 API 测试、断言、Mock 服务和性能测试,还能复用为契约测试,省去拼装多套测试框架的麻烦。
Test Automation Made Simple
README 里没有找到可直接复制的安装命令,请到 README 或官方文档查看安装方式。
README 未说明
把 API 测试、Mock、性能测试和 UI 自动化合并到一个统一框架的开源工具
用一套简洁的 DSL 同时搞定 API 测试、断言、Mock 服务和性能测试,还能复用为契约测试,省去拼装多套测试框架的麻烦。
核心能力
- 用统一框架覆盖 API 测试、Mock、性能测试与 UI 自动化
- 基于 Maven 中央仓库发布,以 io.karatelabs/karate-core 引入
- 文档集中在 docs.karatelabs.io 站点
- v2 版本提供独立模块说明与迁移说明
容易踩的坑
- v2.1.4最新正式版2026-10-22 · 2026-10-22 07:56 UTC
⚠️ Breaking Changes
These all tighten the mock server's defaults for handling request data and are unlikely to affect most teams. If you don't use Karate mocks, nothing here needs action. If you do, a mock that runs processes, or resolves markers or embedded expressions from files and values built at runtime, opts back in with one
configureline, given in each bullet.- Mock server:
karate.exec()/karate.fork()are off by default in a mock;configure javaBridgeEnabled = trueturns them back on #3067 - Mock server: a
match/karate.match()marker that names a variable (#[] schema,##(schema),#? _ == expected) resolves only when written in the mock feature itself; a marker held in aread()schema or built at runtime fails with a message naming the opt-in,configure requestExpressionsEnabled = true#3067 - Mock server: an embedded
#(...)inside a value built by JS (({ a: '#(' + name + ')' }), akarate.call()result, a file read through an ext provider) is left verbatim unless that exact token is written in the mock feature or a file itread()s;configure requestExpressionsEnabled = truerestores evaluation #3067 - Mock server: a feature called from a mock (
call,callonce,karate.call()) runs with the mock's defaults —Java.type(),karate.exec()/karate.fork()are off and request data it receives stays inert; a helper that needs them has the mock opt in withconfigure javaBridgeEnabled = true/configure requestExpressionsEnabled = true#3067
Important Fixes
- Mock server:
karate.requestis treated as request data, and an XML request body is untrusted like a JSON one #3067 - Reports mask credential headers (
Authorization,Cookie,Set-Cookie,Proxy-Authorization) as***by default in HTML, JSONL, Cucumber JSON and JUnit XML (console unchanged);configure logging = { mask: false }shows them again - Gherkin: a step outside a Background / Scenario / Scenario Outline (e.g. after an
Examplestable) is a parse error naming its line instead of being silently skipped, as in Cucumber - JS engine: a stray token after a complete statement on the same line (
var x = 'a' b) is reported as aSyntaxError, with a hint when a doubled or stray quote is the likely cause - Mock server: Background functions no longer nest one wrapper per request until
StackOverflowError#3081 - Mock server: an explicit
Content-Typeis kept when the response body is a string #3074 - Mock servers started with
karate.start()are stopped when the scenario (or Suite) that started them ends, so ports are released #3096 driver.quit()in a called feature releases the pooled driver, so later browser starts no longer time out (2.1.3 regression) #3093- Appium driver types (
android/ios) no longer silently start desktop Chrome; an unsupported driver type fails fast (2.1.3 regression) #3092 - Gatling: concurrent users are no longer capped at CPU×2 (each feature runs on a virtual thread), and a KO from a failed custom perf event is reported once on the right row #3094
- A feature-level
@ignoreno longer skips the feature when a:linefilter selects a scenario (v1 → v2 regression) #3083 - Scenario Outline Examples columns no longer freeze to row 1 after
karate.set(callSingle(...))of a target with a nestedcall/callonce#3080 karate.match()2-arg form resolves dot-notation variable references inside#(...)/##(...)/#[]schema markers #3066- HTML report pass % reads 100 only when nothing failed (3120 of 3121 is 99%) #3065
- A Gherkin description line starting with a step keyword (e.g.
When paused, ...underFeature:) no longer drops the Background that follows - Server mode: the session cookie is
Secureonly over https, so sessions survive plain http on a LAN IP or container hostname
New Features & Enhancements
configure afterFeaturehook;ScenarioRuntime.currentOrNull()is available in Java glue during it #3097- Mock variables are readable from t
- Mock server:
- v2.1.32026-09-27 · 2026-09-27 05:16 UTC
查看更新说明
Important Fixes
karate.call()with a real HTTP request no longer repeats the first response when called in a loop with updated params (2.1.1 → 2.1.2 regression) #3030karate runwithkarate-pom.jsonno longer runs every feature twice (2.1.2 standalone) #3041- A feature-level
@failtag is inherited by every scenario in the feature (v1 → v2 regression) #3029 karate.read()no longer corrupts.xlsxand other Office / zip-based files #3021read()accepts a dynamic, concatenated path expression #3022- Browser file upload restored via
inputFile()for both CDP and W3C backends #3015 byte[]variables are no longer shared by reference throughcallonce/callSinglecaches, and primitive arrays no longer crash on unchecked casts #3014- Error output shows the file name and line number everywhere #3024
- Cucumber JSON report scenarios carry
start_timestampagain #3047 optional('#missing').click()does nothing for an absent element instead of throwing #3042driver.script()no longer adds an extra invocation to an arrow IIFE #3046JSON.stringify()keeps the quotes when serializing a scalar string #3043- An explicitly constructed
java.lang.StringkeepshashCodeandequalsIgnoreCase#3045 - The Java
Stringconstructor works when its byte-array argument is a method call #3044 - Mock server:
pathParams,requestUrlBaseandrequestMethodare treated as untrusted request data like the other request variables, and the file session store rejects crafted session ids #3064 - An
Errorthrown past a step now fails its scenario instead of reading as passed
New Features & Enhancements
- JS engine: class static initialization blocks,
structuredCloneandperformance.nowglobals, and many spec-conformance fixes - Match:
match,karate.matchandassertfire aMATCH_EXITrun event for listeners - HTTP:
Http.quiet()for callers that treat a 4xx/5xx as a normal outcome; a mock'sresponse.bodycan be mutated in place - Run events: every scenario execution carries a run-unique
executionIndex, and a listener failure no longer keeps an event out of the stream - Gatling: the log replay names each scenario and descends into called features
- Logging: the bundled
logback.xmlsets only parent loggers, so the default console matches the docs;logging.consoleprecedence is documented #3031 - Server mode:
ka:data,ka:vals,ka:dispatchand theka:→hx-*helpers escape values that would end the attribute - Security docs:
SECURITY.mdnow states the scope for reports — Karate, including the mock server, is test tooling for trusted networks only - Dependency bumps: netty 4.2.18.Final, jackson-bom 2.22.3, slf4j 2.0.20, logback 1.6.4
View the complete list of all issues fixed in this release.
Full Changelog: https://github.com/karatelabs/karate/compare/v2.1.2...v2.1.3
Important: refer 2.0.0 release notes for those upgrading from 1.X
Artifacts
- Maven artifacts
- Standalone JAR (download below)
- CVE / SBOM report (download below)
- v2.1.22026-08-14 · 2026-08-14 04:26 UTC
查看更新说明
Important Fixes
##(schema)optional-marker semantics now apply to schema references — a null value passes #3006- The
methodkeyword resolves variables again (v2 regression) #2997 karate.sort(list)works with a single argument as documented — the key function is optional #2996get[0]with a JsonPath filter returns[]instead of erroring when the path traverses a null node #2995call/calloncewithread()no longer drops a callee-defined key that shares a name with a caller variable #2991- NDJSON response bodies are kept as raw text instead of being silently truncated by JSON parsing #2990
afterScenariohook scope is no longer frozen to the first scenario whenBackgroundusescalloncewith HTTP #2988setaccepts a multi-line docstring expression #2978text/plainresponses are no longer parsed as JSON just because the body starts with a brace #2977#(!^part)schema macro no longer false-passes on a list of objects #2976match contains only deeprespects element multiplicity instead of matching differing multisets #2975- Numeric
match ==no longer equates distinct integers above 2^53 #2974 karate.callSingle/karate.callarguments are passed consistently toclasspath:JS functions across scenarios #2973- OOM under parallel execution fixed — embedded-expression processing no longer deep-copies every variable in scope on every step #2972
- Report keeps per-step / HTTP detail for
karate.callSingle()calls made duringkarate-config.jsresolution #2967
New Features & Enhancements
- JS engine:
async/await/ Promise runtime withsetTimeoutsupport - JS engine: private class fields, methods and accessors;
WeakMap/WeakSet; labeled statements withbreak/continue - JS engine: significant performance work — slot-frame resolution for function locals, token caches, static binary operators
- Image: new pixelmatch comparison engine with cluster verdict and
ignoredBoxes#2987 - HTTP:
csv,yaml,tomlandmarkdownare recognized named content-types - Mocks: a Karate mock discloses itself on the wire via a
Karate-Mockresponse header - Gatling: failure detail aligned across the KO message and log output #2998
- Memory: a step's captured logs and embeds are released at feature end, and suite-exit no longer re-ships the whole run
- A dry run no longer prints as a green pass, and its result says so
- A missing
karate-config.jsis logged at INFO instead of WARN - Dependency bumps: jackson-bom 2.22.1
View the complete list of all issues fixed in this release.
Full Changelog: https://github.com/karatelabs/karate/compare/v2.1.1...v2.1.2
Important: refer 2.0.0 release notes for those upgrading from 1.X
Artifacts
- Maven artifacts
- Standalone JAR (download below)
- CVE / SBOM report (download below)
- v2.1.12026-07-15 · 2026-07-15 10:14 UTC
查看更新说明
Important Fixes
karate.match()inside a closure passed across feature files resolves variables in the calling scope, not the defining scope #2966karate.remove()now removes nested JSON fields #2953get[0]with a JsonPath filter on a missing property degrades to#notpresentinstead of erroring #2950call/calloncewithread()no longer returns the entire caller scope in the result #2949callonceinside acall read()no longer caches globally across invocations #2941- Escaped pipe
\|inExamplestables is treated as a literal pipe character #2943 paramwith a null value omits the query parameter instead of failing #2942afterFeaturenow fires as expected when running with multiple threads #2939karate.set(callSingle())withcall read()inBackgroundno longer freezes Scenario Outline row values #2934karate.set(callSingle())with the disk cache no longer wipes config-levelJava.type()variables #2933- Feature calls made from JS helper files show up in the summary report again #2928
- Gatling: feature errors are logged, ANSI escapes are stripped from log files, and
--no-coloris accepted #2937 --no-coloris applied and stripped before subcommand parsing #2936- Gatling: a scenario that fails before any HTTP request emits a synthetic KO instead of vanishing from the report
- Gatling: feature chaining repaired — the mutable
__karatemap is matched on read - A non-SSE GET against
HttpServeris rejected with a real status (405/404) rather than hanging - DOM nodes render as XML text instead of crashing json-smart
- Driver: page-load waits are bound to the navigation's
loaderId, closing a class of races on redirects and replaced loaders - Driver: each pooled slot gets its own browser context, and tab enumeration is scoped to the driver's own context
New Features & Enhancements
- The HTML report opens far faster and uses much less memory on large features — syntax highlighting is deferred until a block is viewed #2938
- Failures pinpoint the feature-file location, with a richer failure console #2952
- Driver:
select()fires the full real-selection event sequence (input,change,blur,focusout) - Driver: new
CdpDriver.objectId(locator)for locator to CDP-node resolution - CDP: named init-script registry, plus
DOM.getFrameOwner/describeNodeand script/binding injection wrappers - WebSocket: subprotocol negotiation support in
WsClient - HTTP: bind-host support on
HttpServerfor localhost-only hardening BootLoader.bootOnly,BootBinding.getGlobals()andConfigLoader.configOnly— evaluate boot and config without running features- Report: kind-labelled embed badges, skipped tiles, and Scenario Outline badges
- Dependency bumps: Selenium, the Scala / Gatling plugins, and central-publishing-maven-plugin
View the complete list of all issues fixed in this release.
Full Changelog: https://github.com/karatelabs/karate/compare/v2.1.0...v2.1.1
Important: refer 2.0.0 release notes for those upgrading from 1.X
Artifacts
- Maven artifacts
- Standalone JAR (download below)
- CVE / SBOM report (download below)
- v2.1.02026-06-17 · 2026-06-17 04:48 UTC
查看更新说明
⚠️ Breaking Changes
- Mock servers no longer evaluate untrusted request data as code by default. Java interop (
Java.type) and embedded-expression evaluation of request-derived data (request,requestHeaders,requestParams) are now off by default for mocks, closing a remote-code-execution risk. A mock that uses Java interop or templates off request content must opt in — addconfigure javaBridgeEnabled = trueand/orconfigure requestExpressionsEnabled = trueto the mockBackground(or set.javaBridgeEnabled(true)/.requestExpressionsEnabled(true)onMockServer.Builder). #2927
Important Fixes
- match through a null/undefined/absent intermediate path degrades to
#notpresentand never resolves a same-named variable in scope (e.g. a Scenario-Outline Examples column) #2926 #2906 #notpresentworks across multiple Examples columns on absent paths #2924- Gatling simulations auto-read
-Dkarate.env/KARATE_ENVagain #2925 <column>expansion of an object column in a dynamic Scenario Outline #2921- schema cross-references resolve when loaded via
call read()#2919 configure headers/cookiesmutations to the source object are reflected per-request #2918getwith a JsonPath filter[?(@.field=='value')]no longer returns null #2916call read('file.js')(args)immediately-invoked JS parses correctly #2915- JS-driven feature calls (
karate.call) appear in the report and summary #2914 #(variable)in an Examples table no longer throws ReferenceError when the called feature usescallSingle#2913@setupscenario can be called by tag / manually #2908- HTML report pass% (donut) reconciled with the totals row when scenarios are skipped #2907
__argis defined for called scenarios and top-levelrunFeature(path, arg)#2905bytesdatatype keyword wired up #2904- per-Engine isolation of built-in constructors and prototypes #2920
- browser driver: re-arm OOPIF auto-attach across pooled-driver reuse and CDP session switches #2922
afterScenariohook runs before driver/channel teardown #2923
New Features & Enhancements
- console logging can be fully silenced — new
off/nonelevels #2917 - author-set
__idfor stable scenario identity, pluskarate.scenario.slug request.bodyJsonconvenience accessor- HTML report KPI summary-card hook; scenarios show effective (inherited) tags
karate.getConfigDir()exposes the resolvedkarate-config.jsdirectory- dry-run reports steps as skipped (not passed)
View the complete list of all issues fixed in this release.
Full Changelog: https://github.com/karatelabs/karate/compare/v2.0.10...v2.1.0
Important: refer 2.0.0 release notes for those upgrading from 1.X
Artifacts
- Maven artifacts
- Standalone JAR (download below)
- CVE / SBOM report (download below)
- Mock servers no longer evaluate untrusted request data as code by default. Java interop (
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Karate
The open-source tool that combines API testing, mocks, performance testing, and UI automation into a single, unified framework.
The previous README monolith is preserved at:
github.com/karatelabs/karate/tree/v1.5.2.RC2
Anchor links (e.g. #syntax-guide, #configuration) can be appended to navigate directly to specific sections.
See README_V2.md for v2 module descriptions, feature highlights, and migration notes.