Changelog History
Page 2
-
v0.6.1 Changes
October 08, 2017💥 Breaking Changes
Java API method signature change
➕ Additional
boolean
argument,true
to process (andfalse
to skip) the evaluation ofkarate-config.js
at the start._$
instead of$
formatch each
📚 In case you were using
$
for cross-field validations combined with amatch each
, the concept of a 'self parent' was introduced, since you may still need the 'real' root$
. Refer to the documentation.🛠 Notable Enhancements & Fixes
No more Stack Trace bloat
👀 Yes, finally. Making sense of the console logs used to be difficult when scripts failed, and Karate used to dump a lot of un-necessary stack-traces. Not any more. Failures now are reported in as few lines as possible, line-breaks are included to make it easier to read (instead of scrolling around for very long lines) and the offending line number and feature-file name are clearly shown. Do submit feedback if you see any opportunities to improve further !
__arg
refers tocall
argument #206📚 Yes, we should have had this earlier. While all key-values are 'unpacked' into the context of the 'called' feature, it does make sense to be able to access the passed-in argument as-a-whole. Refer to the documentation. This is a nice companion to
__loop
which was introduced in the previous release.SSL bypass fix #193
🔧 Handling SSL without needing a certificate was broken in some cases. In case you were having to use a certificate for HTTPS, do try setting
* configure ssl = true
and it should now work without needing a certificate.Scripts can introspect Cucumber tags #191
✅ You can ask Karate for the values of all tags in scope. And for advanced users, Karate now natively supports tags with values in the form
@name=value1,value2
. Tag 'inheritance' works as you expect since in Cucumber, you can have tags at the level of aFeature
,Scenario
orScenario Outline
and even for rows withinExamples
. The possibilities are best explained in this example:tags.feature
For even more advanced users, there is a way in which you can set up custom tag filtering. Thanks to Sunil Sishtla for the pull request.
🖨
print
now takes comma delimited arguments #190📚 Which means you no longer need to use
karate.pretty()
in most cases. Refer to the documentation.set
keyword can append to JSON arrays #189\* def foo = {}# you can update json arrays (or create them automatically)\* set foo.bar[0] = 5\* match foo == { bar: [5] }# omit the array index to append\* set foo.bar[] = 6\* match foo == { bar: [5, 6] }
parallel runner console stats now includes the count of feature files
And decimal-places reined in.
==================================================== elapsed time: 3.62 | total thread time: 13.79 features: 31 | threads: 5 | efficiency: 0.76 scenarios: 70 | failed: 0 | skipped: 0 ====================================================
!contains
(not contains) for strings now works #201!=
(not equals) implementedYou won't need this most of the time, but still.
👍
charset
now supported in theContent-Type
header #203Experimental HTML report for JUnit
✅ When you use the
@RunWith(Karate.class)
annotation, an HTML file will be generated in thetarget/surefire-reports
directory. As of now, it is not useful - but we will be enhancing this to make troubleshooting in dev easier. The long-term goal is to have HTML reports 'native' to Karate that better reflect API-testing concerns. -
v0.6.0 Changes
September 13, 2017💥 Breaking Change
match
is stricter: data-types have to matchFor example, Karate will no longer treat
'5'
as equal to5
,'true'
as equal totrue
and vice-versa. So - this would have failed in previous versions.\* def foo = { a: '5', b: 5, c: true, d: 'true' }\* match foo !contains { a: 5 }\* match foo !contains { b: '5' }\* match foo !contains { c: 'true' }\* match foo !contains { d: true }
The new behavior is the right thing to do - especially for a test / assertion framework. There is a good chance that all your existing tests are OK, but think of this as a way to actually surface cases where the server-side is not treating data-types correctly.
Notable Enhancements
karate.eval()
JS method introduced🏗 Not recommended for daily use, but you now have the option to dynamically create javascript fragments and evaluate them, and mix them into the right-hand-side of a
match
expression. Useful if you want to build a custom framework over Karate.✅ Reporting: HTTP logs in-line and
call
-ed feature steps show up📦 Really improves the trouble-shoot-ability of Karate runs, even if in parallel. Variable values are also dumped on failure. Here is a short video. One more change is that the feature file package + file-name is used as the test-name instead of the text in the cucumber feature, which is way more useful and relevant for API test-suites.
Gradle instructions
👀 See doc. Thanks to Mark Corkery for the pull request
Debug hook to improve IDE debug-ability
Experimental, but there is a new
com.intuit.karate.Debug
class designed to be easy to set conditional breakpoints in your IDE. Do let us know if it can be improved.Built-in variable called
__loop
for each data-driven iteration within acall
-ed feature👉 Useful especially for this common pattern: to look up a corresponding row from any
table
or array in scope, typically a variabledef
-ined in the parent orcall
-ing feature.Short-cut to denote Json-Path in right-hand-side expressions
Best explained in this table of Karate right-hand-side expression shapes.
Short-cut to
get[n]
single array element out of a Json-Path resultAgain, best explained in this table.
🏗
set
on steroids - build complex nested payloads from scratch📚 Quick sample in this gist. Works for XML as well. Refer to the documentation.
✂ Removed dependency on
commons-io
andcommons-lang3
✅ Greatly reduces the risk of conflicts when integrating Karate into existing / legacy test-suites.
Implemented missing
^^
macro short-cut forcontains only
Here is a nice summary of all syntax as a cheat-sheet.
Frequently Requested Demos
- Using JDBC via Java interop and querying a database from within a Karate script.
- Reading JSON and XML files from the file-system to use in
match
(orrequest
)
🛠 Notable Fixes
#115
form field
params should land in the URL on a GET
🏁 #126 Karate UI would fail on Windows
#155 Multiple optional##(expr)
removals in JSON would fail
👍 #157graphql
supported as a text-file extension (thanks to Sunil Sishtla) for the pull request.
🛰 #163 Optional##(expr)
syntax was not substituting value correctly for non-match scenarios, for e.g. payload formation
#173 multi-value params for apache - thanks to Matt Johnson for the pull request.
#175 parallel-executor shuts down threads, avoiding thread / memory leaks
#179 scenario failures no longer abort the whole feature, other scenarios would still run
🔧 #178configure followRedirects
implemented - Karate can be told to not follow-redirects so that you can inspect theLocation
header if needed