Skip to main content

IDE SUPPORT

Visual Studio Code

The Karate Labs VS Code extension provides a complete development environment for Karate tests with advanced features like debugging, auto-completion, and integrated test execution.

Installation

Install the extension from the VS Code Marketplace or search for "Karate" in the Extensions view.

Requirements:

  • Java 17+ (for Karate 1.5.0+) or Java 11+ (for Karate 1.4.x)
  • Language Support for Java extension (recommended for Maven/Gradle projects)

Extension Features by License

PLUS

Core

  • Syntax coloring
  • Run tests from editor
  • Run single Scenario
  • Launch Configs
  • Outline View
  • Code formatting
  • Test Results in IDE

PRO

Includes all in PLUS

  • Auto Complete
  • Code Folding
  • Jump to references
  • JSON Formatting
  • Run Test Folder
  • Run Add-ons (Kafka)
  • Debug Tests
  • Run as mock
  • cURL import
  • OpenAPI support

ENTERPRISE

includes all in PRO

  • Priority support
  • SSO/SAML support
  • Offline license
  • Contact us
Legal Notice

By using this extension, you agree to the Karate Labs EULA. Data on a few user actions is collected and subject to our Privacy Policy. HTML reports generated by the Karate open-source library has additional analytics.

License Activation

Online License

  1. Open Command Palette (Ctrl+Shift+P / Cmd+Shift+P)
  2. Type "Karate" and select Sign In / Manage License
  3. Click Sign In to authenticate with your Karate Labs account
  4. Copy the session ID from your browser
  5. Paste the session ID into VS Code and press Enter

Once authenticated, you can work offline. Use the same command to check remaining session days.

Offline License (Enterprise Only)

For enterprise customers requiring offline licenses:

  1. Run Sign In / Manage License command
  2. Click Offline License
  3. Copy the unique system code (e.g., DhHOFKHvd7XYTi+rQnNTJQ==)
  4. Send the code to your designated admin
  5. Paste the received license file content (starting with -----BEGIN LICENSE FILE-----)
  6. Press Enter to activate

Configuration

Settings

Access extension settings via Extensions → Karate → Settings (gear icon).

Run Mode

vscode-java (Recommended)

  • default mode for Maven/Gradle projects
  • Requires Language Support for Java extension
  • Automatically detects project dependencies

standalone

  • Uses Karate standalone JAR
  • Set karatelabs.karate.run.modeJars to folder containing JARs
  • All JARs in the folder are included in classpath

custom

  • Run commands like java or mvn directly
  • Commands must be in system PATH
  • Use ${karateArgs} placeholder for generated arguments

Classpath Settings

  • karatelabs.karate.run.classpathPrefix: Default . (project root)
  • Add comma-delimited entries: .,src/test/java
  • Include JAR files if needed

Workspace Settings

Create .vscode/settings.json for team-wide settings:

{
"karatelabs.karate.run.mode": "vscode-java",
"karatelabs.karate.run.classpathPrefix": ".,src/test/java"
}

Launch Configurations

Create .vscode/launch.json for reusable test configurations:

{
"version": "0.2.0",
"configurations": [
{
"type": "karate",
"name": "env-test",
"request": "launch",
"karateArgs": [
"-e", "test",
"-t", "@smoke",
"${file}"
]
},
{
"type": "karate",
"name": "parallel-run",
"request": "launch",
"noDebug": true,
"karateArgs": [
"-T", "5",
"src/test/java"
]
}
]
}

Supported Options:

  • Environment selection (-e)
  • Tag filtering (-t, ~@ignore)
  • Parallel execution (-T)
  • Custom JVM parameters
  • Working directory control

Code Intelligence (PRO+)

Auto-completion

  • Karate keywords and syntax
  • Built-in functions and variables
  • Context-aware suggestions

Code Folding

  • Collapse scenarios and features
  • Focus on specific test sections

Outline View

  • Navigate large feature files
  • Jump to scenarios and examples

JSON Formatting

  • Lenient format (single quotes, unquoted keys)
  • Strict JSON format
  • Single/multi-line conversion
  • Triple-quote formatting

Debugging (PRO+)

Karate Debugging

  • Set breakpoints in feature files
  • Step through test execution
  • Inspect variables and responses
  • Hot-reload simple edits
  • Step backwards through execution

Java Integration

  • Debug Java and Karate in same session
  • Java breakpoints stop during Karate execution
  • Start from Java debug session and stop at Karate breakpoints (requires Karate 1.5.0.RC3+)

Mock Server (PRO+)

Run feature files as mock servers:

  • Right-click .feature files → Run as mock
  • Support for JavaScript mocks (.js files)
  • Perfect for service virtualization

Test Results

HTML Reports

  • One-click access to detailed reports
  • Request/response logs included
  • Timeline view for parallel execution

IDE Integration

  • Test status in editor
  • Error highlighting
  • Quick navigation to failures

Troubleshooting

Common Issues

Extension Conflicts

  • Disable other .feature file extensions
  • Ensure Karate Labs extension is active

Java Setup

  • Verify Java 17+ is installed and in PATH
  • Set JAVA_HOME environment variable
  • Install Language Support for Java extension

Indicators to Check

  • "Java Ready" indicator for Maven/Gradle projects
  • Karate syntax highlighting active
  • CodeLens buttons visible in feature files

Debugging Problems

Karate Log

  1. Open Output panel (View → Output)
  2. Select "Karate Log" from dropdown
  3. Check for error messages

Increase Log Level

  1. Command Palette → "Developer: Set Log Level"
  2. Select "Karate Log"
  3. Set to "Debug" for detailed information

Workspace Configuration

Ensure your workspace has proper structure:

  • Maven/Gradle project files in root
  • Feature files in standard locations
  • karate-config.js accessible from classpath

Resources

Next Steps