Test Automation Made Simple
This is a Release Candidate for teams to try the version which is "in development" - and identify potential issues or un-intended breaks in functionality.
Please look at the last 1.1.0.RC3 release for details on what to expect. There are many small improvements. The highlight of this release is a focus on performance and reduced memory usage.
Note that the Docker container has not been released.
To see a list of issues that should be fixed in this version, look at the issues here that have the fixed
tag.
This is a Release Candidate for teams to try the version which is "in development" - and identify potential issues or un-intended breaks in functionality.
Please look at the last 1.1.0.RC3 release for details on what to expect.
We've been trying to fix a particular bug related to the use of karate.callSingle()
and mixing Java code - so this release is mainly for that set of users.
Note that the Docker container has not been released.
To see a list of issues that should be fixed in this version, look at the issues here that have the fixed
tag.
This is a Release Candidate for teams to try the version which is "in development" - and identify potential issues or un-intended breaks in functionality.
One significant change is that the @ignore
tag is now "built-in". We decided this made sense after observing 4 years of Karate usage. What this means is that you no-longer need to pass ~@ignore
on the command-line or test-runners, it has become a "baked-in" convention.
Take a moment to review all the "magic" tags in Karate. There are just a few. And note the brand-new tags @env
and @envnot
they can be really useful when you switch environments a lot. They can "bind" or "un-bind" some tests to some environments. You can find the docs here.
In the last release we considered making a breaking change to the path
keyword. We got a lot of feedback and realized a lot of teams used the pattern we were trying to change. Thanks to everyone who provided feedback and proposed alternatives and it helped a lot ! We have a better solution in place.
If you use karate-gatling
take some time to read this thread. We've tried to make it easier to re-use existing test-suites as performance-tests by avoiding some configuration or conditional logic you needed to take care of previously. Please do test these improvements out, they can make a big difference - and we need the feedback !
Note that the Docker container has not been released.
To see a list of issues that should be fixed in this version, look at the issues here that have the fixed
tag.
This is a Release Candidate for teams to try the version which is "in development" - and identify potential issues or un-intended breaks in functionality.
The path
keyword will encode the /
character. You do not need to ever include the /
character. Always build path-strings by using the comma-delimited form of path
. Please change your tests to never use the /
character on the right side of the path
keyword.
Before:
* path 'foo/bar/' + someVariable
After:
* path 'foo', 'bar', someVariable
As a convenience, if you have a lot of tests in the old, no-longer-supported form, you can use path raw
to fall-back to the old behavior. But we recommend that you switch to the recommended path
form above to avoid breaking your tests again in the future.
The rationale is that Karate will apply URL-encoding to the path
for all cases, including the /
character. For a detailed discussion, see #1561. Note that url
can be always used if you want to force a specific string, and no URL-encoding will be performed in that case.
Note that the Docker container has not been released.
To see a list of issues that should be fixed in this version, look at the issues here that have the fixed
tag.
This is a Release Candidate for teams to try the version which is "in development" - and identify potential issues or un-intended breaks in functionality.
Note that the Docker container has not been released.
To see a list of issues that should be fixed in this version, go here.
This fixes a few major bugs in version 1.0.0 (that was released only 3 weeks ago) that only a small proportion of teams would run into. But it is recommended that you upgrade. Those who use karate.callSingle()
should definitely upgrade. Thanks to all those who helped troubleshoot and help us fix these.
The details of the 9 issues closed can be found here.
Those migrating from versions of Karate less than 1.0 - should refer to the upgrade guide.
A big Thank You to all users and supporters of Karate ! We have come a long way. Please show your support by adding a ⭐️ to our GitHub page.
Karate has so many useful capabilities ! We created this "map" so that you can see how they come together to solve the test-automation challenges that all teams face.
A lot. You can get a good summary from this article by Peter Quiel: 7 New Features in Karate Test Automation Version 1.0.
More details are provided in the upgrade guide (see link below).
In short - we successfully migrated the JS engine from Nashorn to GraalVM and were able to re-factor and clean up the code to a large degree.
It is highly likely that your tests will continue to work without changes. But there can be breaks depending on how much JavaScript and Java inter-op you are using. Also, Maven and Gradle users have one less dependency to worry about - please look out for that.
The finer details are in this wiki-page: 1.0 Upgrade Guide.
We have a record number of pull-requests this time ! A big round of applause 👏 for these open-source heroes !
@maxandersen #1514 @edwardsph #1478 #1479 @pcbue #1468 @jkeys089 #1403 @ivangsa #1396 #1399 #1401 #1402 #1404 #1423 #1427 #1425 #1443 #1444 #1449 #1471 #1477 #1476 #1503 @theathlete3141 #1383 #1408 #1410 @manuarlin #1345 @kruthika16 #1336 @chaudharydeepak #1314 #1316 #1328 #1332 #1334 #1347 #1354 #1400 @liranz10 #1310 @joelpramos #1317 #1339 #1398 #1416 #1429 #1437 #1439 #1438 #1441 #1453 #1454 #1447 #1464 #1472 #1493 #1494 #1496 #1497 #1508 #1513 @douglas-six #1301 #1302 #1323 #1335 #1315 @Nishant-sehgal #1299 #1307 #1318 #1344 @michaelpro1 #1288 #1291 @babusekaran #1275 #1349 @orisvogel #1273
Special thanks to @kirksl who created the Karate Runner Visual Studio Code extension which has crossed 8000 installs to date.
For a list of all issues closed in this release, go here.
To keep track of news and releases, follow us on Twitter @KarateDSL or on LinkedIn by joining this group.
configure callSingleCache
- so that you don't need to wait for a "sign-in flow", every time you re-run a test in dev modedriver.inputFile()
- Chrome-native file-uploadlocateAll()
, parent
, children
etc.match
can finally be used in JS with all the power you normally have in feature files, see this thread and some extras to introspect object / data types within JS blockscontains deep
for recursive nested JSON matching (see example)match contains
will not recurse nested items any more, use contains deep
as explained abovekarate.stop()
now takes a mandatory port number argument, so you can call the same (static) cURL
command to resume, e.g. curl localhost:8080
exists()
API refactored for UI tests, see this thread for detailsmatch
with a primitive number on the right-hand-side could incorrectly pass, this should be very rare - see this thread for details\
) character was getting swallowed in doc-string (triple-quote) sections, so in case you were escaping them, you don't need to any more (commit details)For a list of all issues closed in this release, go here.
To keep track of news and releases, follow us on Twitter @KarateDSL or on LinkedIn by joining this group.
Thanks to the following rock stars for contributions and pull-requests ! @10twenty4 @a-st @abhi-rao @babusekaran @cueo @michaelpro1 @maxandersen @kchopperla @KostasKgr @ewexlerr @joelpramos @kirksl @luizvaz
Karate is in the running for "Best Open Source Project" in the HackerNoon "Noonies".
Show your appreciation for Karate by voting here: Best Open Source Project
And here for the lead-developer of Karate (Peter Thomas): Contributor of the Year - OPEN SOURCE.
Thanks !
This took a while ! The last release was in July 2019 - but it does indicate that 0.9.4 was super-stable and that Karate for API testing is quite feature-complete. So what's new ? Web Browser Automation !
A lot of work went into this area, and the feedback from early adopters who used 0.9.5.RCX has been extremely encouraging. And now 🥁 we consider it ready for use.
To know more about how Karate is different from (and better in our opinion than) the competition - please read this blog post: The world needs an alternative to Selenium - so we built one.
One additional point that is going to give us an edge over other browser-automation solutions is this - because Karate embeds a web-server (via the test-doubles capability) you can submit a self-contained snippet of HTML as a full-fledged project - to demo or replicate issues. The beauty of this is that it would run completely locally, yet perfectly replicate any exotic edge case. We put a lot of thought into Karate to make it easy for developers to build, extend and maintain, and if you find any gaps in the web-browser automation - we should be able to release minor / dot-releases pretty quickly.
What we used to call the "Karate UI" (implemented in JavaFX) has been retired.
Now we have what we feel is a game-changer - a debugger which is part of the Visual Studio Code extension for Karate created by Kirk Slota. This debugger is special - it can not only step-through code, but step backwards and hot-reload code. Note that this works for any Karate test, so API and UI automation is covered. See this video of the Karate-Runner in action. Thanks also to @peterquiel who contributed syntax-coloring support to the Karate-Runner.
Note that you can point the Karate-Runner to an existing Maven (or even Gradle) project, and it will work fine. The new ZIP Release is ideal for especially non-Java teams - who don't want to use Maven or Gradle.
We know of many .NET, JS and Python shops using the Karate standalone JAR - and the ZIP Release makes a very compelling case for Karate and UI automation. There is no need to compile code, and reports are built-in.
configure abortedStepsShouldPass
You will need to be aware of this only if you use the karate.abort()
keyword and an old version of the cucumber-reporting library - and if you want steps after an "abort" to pass - #755
karate.get()
now takes a default value, which is very useful for conditional logic and "called" features where a variable has not been "pre-defined". Note that karate.get()
is very flexible, it can evaluate even Json-Path and XPath - not just variable referencesExecutionHook
interface has been introduced for more control over the life-cycle and for teams that need to integrate with 3-rd party reporting solutions and the like, and you can inject your custom implementation via the parallel Runner
- #855Authorization
headers and passwords being persisted and leaked - #699karate.log()
now "pretty prints" JSON and XML, so you don't have to resort to things like JSON.parse()
and JSON.stringify()
in your JavaScript snippets. Note that you should never need to use things like JSON.parse()
- and they cause problems in the long term.@KarateOptions
annotation for the parallel runner any more. Use the "builder" methods on the Runner
class, which handles multiple features (or just directory / paths), tags, and the number of threads. Going forward, as a best-practice, you are recommended to not use the annotations any more - and if you use JUnit 5, you don't need it at all, see the example belowKarate.run()
, see below:For a list of all fixes in this release, see here.
Thanks to @paaco, @Celeo, @peterquiel, @ghostwriternr, @sivachithambaram, @BadgerOps, @man007yadav, @Nishant-sehgal, @TamannaBhasin27, @benjaminqc, @babusekaran, @celcius112, @khanguyen88 and @kirksl for pull-requests and other contributions. You rock !
There is only one and only for those who use the standalone JAR file. When tests are run - the cucumber-json and junit-xml report output files will now be in target/surefire-reports
not directly in the target
directory. This prevents the inclusion of other JSON files into the report generation routine which would break the HTML report.
There are some bug fixes, and the main improvement is that the eval
keyword is un-necessary (optional) for most cases - which makes Karate very close to pure JavaScript as a scripting language.
Also - the Maven archetype (quickstart) now uses JUnit 5 instead of JUnit 4 - which simplifies the code a lot for newcomers.
There is a bug in the quickstart, please read this as well: fix for 0.9.4 Maven archetype.
See complete list of fixes here.
eval
keyword optional for most casesWhich includes any method call or operations on variables in scope and where you "don't care" about the returned value. Examples are:
# using any API on the "karate" helper
* karate.env
# where "foo" is of type function(){}
* foo()
# where "bar" is a variable in scope
* bar.baz()
# if statements for conditional logic
* if (responseStatus == 200) karate.call('delete-user.feature')
This greatly simplifies Karate mocks as evident in this diff below !
Note that now we recommend that you directly use JavaScript instead of the set
keyword when needing to "update" an existing JSON variable. If you need to remove a JSON key where the key name is dynamically derived, use karate.remove()
as shown above.
Note that these rules apply to the Left Hand Side of the match
keyword - so you can do things like this now - note the combination of match
and karate.filterKeys()
:
* def schema = { a: '#string', b: '#number', c: '#boolean' }
* def response = { a: 'x', c: true }
# very useful for validating a response against a schema "super-set"
* match response == karate.filterKeys(schema, response)
* match karate.filterKeys(response, 'b', 'c') == { c: true }
* match karate.filterKeys(response, ['a', 'b']) == { a: 'x' }
In initial versions of Karate, you had to split the last 2 match
steps above into 2 steps.
karate.filterKeys()
API #810And an example appears above. This is very useful for cases where you want to use a "super set" schema that is defined once and you want to re-use. Also in situations where you quickly want to "select" only a few keys out of a given JSON. See the documentation on JSON transforms for more.
karate.start()
APITo start a Karate mock directly from a feature file without needing to write Java code. Refer to the docs here.
karate.os
APITo get meta-data about the runtime operating system, that can be used to drive conditional logic - for example to run a slightly different set-up routine for Mac OS X versus Windows. See documentation here. Here is a representative example:
# looks for "common-windows.feature" or "common-macosx.feature"
* call read('common-' + karate.os.type + '.feature')
call read fileNameString
A short-cut to inject all key-values of a given JSON file into the variables context is now possible, more details in this comment.
Best explained in this video.