-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
ZIP Release
Please use the official IDE plugins instead
Or the stand-alone executable JAR
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.
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 !
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 !
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.
Just extract the ZIP to any directory.
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.
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.
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
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.
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.
Please see the Karate Robot Windows Install Guide.