Skip to content

ZIP Release

Peter Thomas edited this page Feb 21, 2023 · 51 revisions

⚠️ The ZIP Release will not be available in Karate 1.4.0 onwards.

Please use the official IDE plugins instead


Karate can be used as a stand-alone executable, ideal for teams that don't want to use a Java IDE. And you get all the features such as API test-doubles (or mocks) and UI automation with parallel-execution.

No Need to Compile Code

The ZIP release (version 0.9.5 onwards) is even more convenient because it comes with some sample test-scripts, mocks and even web-UI automation scripts out of the box, ideal for demo-ing Karate to others or just getting started quickly.

And you have Visual Studio Code as an IDE option which even has full-fledged debug support !

Pre-Requisites

The only pre-requisite is that Java (just the Runtime Environment and not the full-fledged JDK) should be installed and in your system PATH. It is quite likely that you already have this in place.

To test, type this in a terminal or console window:

java -version

If it responds with a version that is 1.8 or greater (Java version 8), you are all set !

Downloading

Look for the latest release on GitHub and scroll down to find the "Assets". And look for the file that starts with karate- and has a *.zip extension,

Here is a video of what to expect.

Installing

Just extract the ZIP to any directory.

Running

You can run commands from the terminal or console after changing to the root of the folder created when you extracted the ZIP file. Also see IDE Support. To see a list of all possible commands (--help) you can do this:

Mac users:

./karate -h

Windows users:

karate -h

And you can also refer to the detailed documentation. And yes, you can run tests in parallel.

Web Automation

To run the web-browser automation demo, Google Chrome should be installed. Karate should be able to use it if it is in the default install location for your OS.

Mac users:

./karate src/demo/web/google.feature

Windows users:

karate src/demo/web/google.feature

To change browsers or write more tests, please refer to the documentation.

API Testing

Note how you can give a path and Karate will find all *.feature files within it. Note that tags can be used to "include" or "exclude" tests if needed. The examples below show how to "exclude":

Mac users:

./karate -t ~@sometag src/demo/api

Windows users:

karate -t ~@sometag src/demo/api

API Mocks

A great way to demo Karate's capabilities is with this "full-stack" demo, that includes a server and an HTML client.

Mac users:

./karate -p 8080 -m src/demo/mock/cats-mock.feature 

Windows users:

karate -p 8080 -m src/demo/mock/cats-mock.feature 

And then open the src/mock/cats.html in a browser by double-clicking on it. You can click the "Create Cat" button and see HTTP requests being handled by the mock and the UI processing the responses. Navigate to http://localhost:8080/cats and observe the raw JSON server responses.

You can also get more insights about this demo here: The World's Smallest Microservice.

IDE Support

The official Karate plugin for Visual Studio Code gives you syntax coloring and a way to run and even debug tests from within the IDE.

For more details see the wiki on IDE Support.

Karate Robot

Please see the Karate Robot Windows Install Guide.