# Karate — Unified API and UI Test Automation in Plain Text > Karate is an open-source test automation framework that combines API testing, UI testing, mocking, and performance testing in a single, no-code DSL built on Cucumber syntax. ## Install Save as a script file and run: # Karate — Unified API and UI Test Automation in Plain Text ## Quick Use ```bash # Requires Java 11+ mvn archetype:generate -DarchetypeGroupId=com.intuit.karate -DarchetypeArtifactId=karate-archetype -DarchetypeVersion=1.4.1 -DgroupId=com.example -DartifactId=my-test cd my-test mvn test ``` ## Introduction Karate is a test automation framework created by Intuit that unifies API testing, UI testing, mocking, and performance testing into a single tool. Tests are written in a readable plain-text syntax based on Gherkin, but unlike Cucumber, no step definitions or glue code are needed. Karate is built on Java but requires no Java knowledge to write tests. ## What Karate Does - Tests REST, SOAP, and GraphQL APIs with built-in JSON/XML assertion support - Automates browser UI testing via an embedded Chrome DevTools Protocol driver - Mocks HTTP services for contract testing and local development - Runs performance tests by re-using functional test scripts with Gatling integration - Supports parallel execution and generates rich HTML reports ## Architecture Overview Karate parses `.feature` files written in a Gherkin-like DSL and executes steps through a built-in step-definition engine. For API tests, it uses an HTTP client to send requests and match responses using a powerful JSON path expression syntax. For UI tests, Karate embeds a Chrome DevTools driver. The framework runs on the JVM, leverages JUnit 5 for test discovery, and uses a custom parallel runner that distributes scenarios across threads. ## Self-Hosting & Configuration - Add Karate as a Maven or Gradle dependency in a Java project - Requires Java 11 or higher; no other runtime dependencies - Place `.feature` files alongside a minimal JUnit runner class - Configure `karate-config.js` for environment-specific URLs and variables - Use `karate.env` system property to switch between dev, staging, and production ## Key Features - No step definitions needed: the DSL has built-in keywords for HTTP, JSON, XML, and assertions - Embedded JSON and XML support with powerful match expressions (`match ==`, `match contains`) - Data-driven testing via `Scenario Outline` and `Examples` tables - Built-in HTTP mock server for contract testing without external tools - Re-use API tests as performance tests with Gatling integration ## Comparison with Similar Tools - **REST Assured** — Java library for API testing; Karate requires no Java code and includes UI, mocks, and perf testing - **Postman/Newman** — GUI-first API testing with collection runner; Karate is text-based and integrates natively with CI/CD - **Cypress** — JavaScript web testing; Karate combines API and UI testing in one framework - **Cucumber** — BDD framework requiring step definition code; Karate's steps are built in and need no glue code - **k6** — JavaScript-based load testing; Karate re-uses functional tests for performance without separate scripts ## FAQ **Q: Do I need to know Java to use Karate?** A: No, tests are written in a plain-text DSL. Java knowledge is only needed for advanced customizations. **Q: Can Karate test GraphQL APIs?** A: Yes, send GraphQL queries as POST requests with a JSON body. Karate's JSON matching validates responses natively. **Q: How does Karate handle authentication?** A: Use `karate-config.js` to set auth tokens or headers globally, or use `callonce` to run a login flow and share tokens. **Q: Does Karate support CI/CD integration?** A: Yes, Karate runs as standard JUnit tests and produces JUnit XML reports compatible with any CI system. ## Sources - https://github.com/karatelabs/karate - https://karatelabs.github.io/karate/ --- Source: https://tokrepo.com/en/workflows/afaf783a-3f53-11f1-9bc6-00163e2b0d79 Author: Script Depot