Kode Karate
A Visual Studio Code extension that provides comprehensive support for running and managing Karate API tests.
Features
- Run Karate tests directly from VS Code
- Automatic Karate JAR management
- Feature file explorer
- Bug tracking across feature files
- Test run history with HTML reports
- Syntax highlighting for .feature files
- Run individual scenarios or entire feature files
- Utility tools for API testing workflows
Requirements
- Java 11 or higher
- Visual Studio Code 1.60.0 or higher
Installation
- Open VS Code
- Go to Extensions (Ctrl+Shift+X)
- Search for "Karate Runner"
- Click Install
Usage
Running Tests
- Open a .feature file
- Use one of these methods to run tests:
- Click the "Run Test" button in the editor title bar
- Use the command palette (Ctrl+Shift+P) and search for "Karate: Run Test"
- Right-click in the editor and select "Run Test"
Feature Explorer
View and manage your Karate feature files in the dedicated sidebar:
- Click the Karate icon in the activity bar
- Browse your feature files in the Feature Explorer
- Click on a feature to open it
- Use the context menu to run tests
Run History
Keep track of your test runs:
- Open the Run History view in the Karate sidebar
- View past test runs with their results
- Click "View Report" to open the HTML report
- Use "Clear History" to remove old test runs
Bug Explorer
Track and manage bugs across your feature files:
Tag bugs in your scenarios:
@bug/JIRA-1234
Scenario: Test with known issue
Configure bug tracking:
- API endpoint for your bug tracking system
- Status field mappings
- Response parsing rules
Features:
- Folder-based organization of bugs
- Quick navigation to bug scenarios
- Real-time status updates from your bug tracker
- Customizable status display
- Support for multiple bug tracking systems
Example Configuration:
{
"apiEndpoint": "https://your-jira.com/api/issue/{{id}}",
"headers": {
"Authorization": "Bearer your-token"
},
"responseParser": {
"statusPath": "fields.status.name",
"titlePath": "fields.summary",
"statusMapping": {
"In Progress": "In Progress",
"Done": "Closed",
"To Do": "Open"
}
}
}
Utilities
The extension provides helpful utilities to enhance your API testing workflow:
Request to cURL Converter
Convert Karate request logs to cURL commands for easy debugging and sharing:
- Click on the "Request -> cURL" option in the Utilities view
- Paste your Karate request log in the input area. Example format:
1 > POST http://example.com
1 > Accept: application/json
1 > Content-Type: application/json
{"key": "value"}
- Click "Convert to cURL" to generate the equivalent cURL command
- Copy the generated command to use in terminal or share with others
Compare two API responses to identify differences:
- Click on "Response Diff Tool" in the Utilities view
- In the split view:
- Left panel: Paste your first JSON response
- Right panel: Paste your second JSON response
- Use "Format JSON" buttons to prettify each response (optional)
- Click "Compare" to see the differences
- The tool will highlight:
- Value mismatches (orange)
- Type mismatches (red)
- Missing fields in either response (green/blue)
- Exact path to each difference
A comprehensive JWT (JSON Web Token) encoder and decoder similar to jwt.io:
Decode Mode:
- Paste any JWT token to instantly see:
- Decoded Header (pink background)
- Decoded Payload (purple background)
- Signature section
- Human-readable timestamps for:
- Expiration time (exp)
- Issued at (iat)
- Not before (nbf)
- Validate token signature with secret key
- Check token expiration status
Encode Mode:
- Create new JWT tokens with:
- Customizable header
- Customizable payload
- Multiple signing algorithms (HS256, HS384, HS512)
- Secret key input
- Format JSON functionality for easy editing
- Copy generated token with one click
Extension Settings
The extension automatically manages most settings, but you can configure:
- Java path (if not automatically detected)
- Karate JAR version (defaults to latest)
- Bug tracker integration settings
Known Issues
Please report issues on our GitHub repository.
Release Notes
1.4.0
- Added Bug Explorer view
- Support for tracking bugs across feature files
- Integration with bug tracking systems (configurable)
- Folder-based organization of bugs
- Quick navigation to bug scenarios
- Customizable status mapping and response parsing
1.3.0
- Added JWT tool
- UI optimization for Utilities
1.2.0
- Added Response Diff Tool in utilities section
- Enhanced JSON comparison capabilities
- Visual diff highlighting for API responses
1.1.0
- Add a utilities view
- New utility for converting request logs to curl commands
1.0.0
Full release of Karate Runner:
- Better Feature Explorer
- Better Run History
- Added syntax highlight support (Support is added from https://github.com/kirksl/karate-runner. Thanks to the devs of this extension for their extensive work in this.)
- Better and more seamless output format.
- Fixed some critical bugs
0.0.1
Initial release of Karate Runner:
- Basic test running capabilities
- Feature explorer
- Run history
- Automatic JAR management
Note:
This extension is not sponsored by Karate or anyway associated with the devs of karate DSL. They are awesome people and they have their own official extension available for both vscode and IntteliJ. Please check out there for official support -> https://www.karatelabs.io/
Contributing
We welcome contributions!
License
This project is licensed under the MIT License - see the LICENSE file for details.