Skip to main content

GET STARTED

Install & Get Started

Choose the path that fits your workflow. Karate v2 requires Java 21+ for virtual threads support.

Pick your path

Not sure which to choose? Non-technical users and beginners should start with the VS Code extension. Java developers should use Maven or Gradle. Everyone else (scripting, CI/CD, quick tests) should use the Karate CLI.


The easiest way to get started — no Java or build tool installation needed. The VS Code extension installs the Karate CLI and Java for you.

  1. Install the Karate extension from the VS Code Marketplace
  2. Open Command Palette (Cmd+Shift+P / Ctrl+Shift+P) and run Karate: Setup
  3. The Setup Dashboard installs the Karate CLI and Java automatically:

Karate VS Code Setup Dashboard

  1. Create a .feature file, and press Cmd+F5 (macOS) or Ctrl+F5 (Windows/Linux) to run

That's it. Play buttons appear in the gutter next to each scenario. You get syntax highlighting, auto-complete, debugging, and HTML reports out of the box.

See the full VS Code Extension documentation for details on debugging, launch configurations, and license tiers.


The Karate CLI installs everything you need — including a JRE if you don't have Java. No Maven or Gradle required.

Terminal
curl -fsSL https://karate.sh/install.sh | sh

Set up everything (JRE + Karate JAR):

Terminal
karate setup --all

Or if you already have Java 21+:

Terminal
karate setup --item jar

Run a test:

Terminal
karate test.feature

Useful commands:

Terminal
karate doctor          # Check your setup
karate update --all # Update to latest version
karate -T 4 tests/ # Run folder in parallel with 4 threads
karate -t @smoke . # Run only @smoke tagged tests
karate -e qa . # Run with 'qa' environment

See the Karate CLI documentation for the full command reference.


Path 3: Maven

For Java teams already using Maven. Add Karate as a test dependency.

Step 1: Ensure Java 21+ and Maven are installed

Terminal
java -version   # Must be 21+
mvn -v
Need to install Java or Maven?

macOS:

brew install openjdk@21 maven

Windows:

winget install EclipseAdoptium.Temurin.21.JDK
winget install Apache.Maven

Linux (SDKMAN!):

sdk install java 21-tem
sdk install maven

Step 2: Add dependency to pom.xml

pom.xml
<dependency>
<groupId>io.karatelabs</groupId>
<artifactId>karate-core</artifactId>
<version>2.0.0</version>
<scope>test</scope>
</dependency>
Version

Replace 2.0.0 with the latest version from Maven Central.

Step 3: Create a test runner

src/test/java/examples/ExamplesTest.java
package examples;

import io.karatelabs.karate.Runner;
import io.karatelabs.karate.SuiteResult;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertTrue;

class ExamplesTest {

@Test
void testAll() {
SuiteResult result = Runner.path("classpath:examples")
.outputHtmlReport(true)
.parallel(5);
assertTrue(result.isPassed());
}
}

Step 4: Create a feature file

src/test/java/examples/users.feature
Feature: User API

Scenario: Get user by ID
Given url 'https://jsonplaceholder.typicode.com'
And path 'users/1'
When method get
Then status 200
And match response.name == '#string'

Step 5: Run

Terminal
mvn test

Path 4: Gradle

For Java teams using Gradle. Similar to Maven but with Gradle conventions.

Step 1: Add dependency to build.gradle

build.gradle
dependencies {
testImplementation 'io.karatelabs:karate-core:2.0.0'
}

test {
useJUnitPlatform()
// Karate uses virtual threads, ensure Java 21+
jvmArgs '--enable-preview'
}

Step 2: Create test runner and feature files

Same as the Maven path above — create a JUnit 5 test runner and .feature files under src/test/java/.

Step 3: Run

Terminal
./gradlew test

Path 5: Standalone JAR

Download the fatjar and run directly — no build tool needed, just Java.

Step 1: Ensure Java 21+

Terminal
java -version

Step 2: Download

Download karate-2.0.0.jar from GitHub Releases.

Step 3: Run

Terminal
java -jar karate-2.0.0.jar test.feature
java -jar karate-2.0.0.jar -T 4 tests/ # parallel
java -jar karate-2.0.0.jar -t @smoke -e qa . # tags + env

See Standalone Execution for CI/CD examples and full CLI options.


Verify Your Setup

Whichever path you chose, create this file and run it to verify everything works:

hello.feature
Feature: Hello Karate

Scenario: Health check
Given url 'https://jsonplaceholder.typicode.com'
And path 'users'
When method get
Then status 200
And match response == '#[10]'
And match each response contains { id: '#number', name: '#string' }

You should see all assertions pass and an HTML report generated in your output directory.

Next Steps