karate-robot is available from version 0.9.5 onwards. Desktop automation is something that many teams need, so please contribute !
Demo of using Karate and SikuliX for visual testing of Windows desktop apps. And other Karate capabilities that show off the language-neutral stand-alone executable.
What is notable is how you can use the Karate UI to step-through and debug / troubleshoot tests. Click the image below to watch a demo video.
- only a Java Runtime Environment (JRE) is needed as a pre-requisite (version 1.8.0_112 or greater)
- verify this on the command line by typing:
java -version
- verify this on the command line by typing:
- clone this Git repository or simply download it as a zip file and extract it
- download the latest
sikulixapi.jar
from here- this is optional if you only want to run the other demos
- download the latest Karate standalone JAR (
karate-0.9.4.jar
) from here - place the JAR file(s) in the same folder as the project you cloned, and rename the Karate JAR to
karate.jar
- (Windows only) run the command:
karate calc.feature
- you can also step-through using the Karate UI:
karate calc.feature -u
- no Java IDE or code compilation required
- with a "visual" approach, there is no need to worry about getting the control names or id-s and messing around with "inspect.exe"
- being able to step-through and re-play steps is key to maintenance in the long term
- Karate makes things like re-usable functions, assertions and reports possible
- the Karate Visual Studio Code extension created by Kirk Slota allows you to run a feature file directly from the IDE.
Note that you need the sikulixapi.jar
only for the first one below.
Command | Description |
---|---|
./karate web-mac.feature |
Mac only (you may need to make the karate batch file executable first) demo of using SikuliX to automate a web-browser "visually". You can try to edit the test to use another browser, see video |
java -jar karate.jar calc-driver.feature |
(Windows only) using the Microsoft WinAppDriver and Karate's UI automation capabilities, and you can compare this with calc.feature which uses SikuliX |
java -jar karate.jar graphql.feature |
GraphQL web-service API test that shows off advanced JSON assertions in the response. Make sure you view the HTML reports in target/cucumber-html-reports |
java -jar karate.jar github.feature |
Uses Chrome and Karate's native web-browser UI automation capabilities, this should work out of the box if you have Chrome installed |
java -jar karate.jar -m cats-mock.feature -p 8080 |
Starts mock API server on port 8080 , now you can open cats.html from the file system and play around. This demonstrates how web-dev teams can use Karate. |
java -jar karate.jar cats-test.feature |
Runs a test against the mock server above (which has to be started and running first using the above command). You can also add a -u option to see how to step-through a test using the Karate UI. Note how you can re-play any step at any time, something you can't do with traditional IDEs or de-buggers. |
java -jar karate.jar cats-test.feature -e mock |
Shows how a karate feature can start a mock automatically using JavaScript. Compare this with the command above. |