Skip to content

ZIP Release

Peter Thomas edited this page May 31, 2020 · 51 revisions

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.0_112 or greater (Java version 8), you are all set !

Note: Java versions 13 and above are not yet supported.

Downloading

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. You may have to use tags to "exclude" files as shown below:

Mac users:

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

Windows users:

karate -t ~@ignore 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 Karate plugin for Visual Studio Code created by Kirk Slota gives you syntax coloring and a way to run tests from within the IDE. Here is a video of what to expect.

And you can debug tests ! See this video.

For more details see the wiki on IDE Support.

Karate Robot

Please see the Karate Robot Windows Install Guide.

Clone this wiki locally