Karate (software)


Karate is an open-source general-purpose test-automation framework that can script calls to HTTP end-points and assert that the JSON or XML responses are as expected. Karate also has support for service-virtualization where it can bring up "mock" servers which can substitute for web-services that need to participate in an integration-test. Karate's capabilities include being able to run tests in parallel, HTML reports and compatibility with Continuous Integration tools.
The additional capability to re-use functional tests as performance-tests via integration with the Gatling tool was released in July 2018 The project also added the capability to perform web-UI automation in 2019 which was declared out of RC status in 2020.
Karate is implemented in Java but test-scripts are written in Gherkin since Karate was originally an extension of the Cucumber framework. It was built within Intuit and released under the MIT license.

History

Karate was created by Peter Thomas, an Intuit employee.

Basic usage

This example shows what a simple Karate test script looks like and how it is based on the Gherkin syntax.
Feature: karate 'hello world' example
Scenario: create and retrieve a cat
Given url 'http://myhost.com/v1/cats'
And request
When method post
Then status 201
And match response
Given path response.id
When method get
Then status 200

This actually makes two calls, first an HTTP POST to 'http://myhost.com/v1/cats' and then a GET to the same URL but with the value of response.id appended as a REST-ful path parameter. The match keyword is used for asserting that a given payload is as expected. The use of the #notnull "fuzzy match" token takes care of "ignoring" the actual value since it is dynamic, as it is a server-side auto-generated identifier.

Features

Karate was featured as one of the top 5 open-source API testing tools within six months of its release. It was also mentioned as one of the 10 API testing tools to try in 2017.
Karate was first listed in the ThoughtWorks Technology Radar in 2019 with a rating of "Assess". One year later it moved into the "Trial" category in May 2020.