-
-
Notifications
You must be signed in to change notification settings - Fork 2k
ZIP Release
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.0_112 or greater (Java version 8), you are all set !
Note: Java versions 13 and above are not yet supported.
Look for the file that starts with karate- and has a *.zip extension,
- Option 1: Download from Bintray: https://dl.bintray.com/ptrthomas/karate/
- Option 2: Look for the latest release on GitHub and scroll down to find the "Assets"
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. 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
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 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.
Please see the Karate Robot Windows Install Guide.
