GET STARTED
IntelliJ Quick Start (Maven)
Take the karate-todo Maven project to a green run, a bug found from a JUnit debug session, a fix replayed with Step Back, and the HTML report, in IntelliJ IDEA.
You need: IntelliJ IDEA 2026.1 or later, a JDK 21 or later (IntelliJ can download one when it imports the project), Git, and a karatelabs.io account with IDE Plus (to run tests in the editor) or IDE Pro (to debug as well).
Shortcuts below are IntelliJ's default macOS keymap, with the Windows / Linux key in parentheses where it differs.
The Demo Project
karate-todo is a Maven project with a small TODO app and its Karate tests under src/test/java/app/api:
| File | What it shows |
|---|---|
ApiTest.java | A JUnit test: @BeforeAll starts the app from Java (App.start), then the Karate Runner runs every feature under app/api against it. |
cart/cart.feature | A cart invoice computed in JavaScript, both inline and in invoice.js, plus a Scenario Outline with an Examples table. |
cart/invoice.js | The invoice function the feature reads; the place to set a breakpoint. |
interop/interop.feature | Calls the Java class Helper through Java.type(). |
interop/Helper.java | The Java side of that call. |
1. Open the Project
Clone it, or use File → New → Project from Version Control with the same URL:
git clone https://github.com/karatelabs/karate-todo.git
Open the karate-todo folder, trust the project, and let the Maven import finish.
2. Install the Plugin
- Open
src/test/java/app/api/cart/cart.feature. IntelliJ offers Plugin supporting *.feature files found · Install Karate plugin: click it. Or open Settings → Plugins → Marketplace and searchkarate. - Several plugins have similar names. Install Karate whose vendor is Karate Labs Inc. (plugin 19232). No restart needed.
If the Cucumber for Java plugin is installed, disable it: it competes for .feature files.
3. Sign In
- Open Settings → Languages & Frameworks → Karate and click Sign In. Your browser opens Karate Sensei.
- Sign in with Google, GitHub, Microsoft or your enterprise SSO, then copy the session id the page shows.
- Paste it into the field in Settings and click Apply. Settings shows Signed in as … with your products.
The license is saved to ~/.karate/karate.lic, so you sign in once. See License Activation for renewing and offline licenses.
4. Run
- In
cart.feature, click ▶ in the gutter next toFeatureor aScenario, or put the caret in a scenario and press⌃⇧R(Ctrl+Shift+F10). - The Run tool window shows the test tree; a failed scenario shows its reason, such as
match failed. - Right-click a row of the
Examplestable to run that row alone.
ApiTest.java runs like any JUnit test: ▶ in its gutter runs the whole suite against the app it starts.
5. Jump into Java
In interop/interop.feature, put the caret on Helper in Java.type('app.api.interop.Helper') and press ⌘B (Ctrl+B): Helper.java opens. This needs IDE Pro.
6. Debug from a JUnit Test
To see the failure the video debugs:
- In
cart/invoice.js, line 3, changeitem.price * item.qtytoitem.priceand save. TheScenarioincart.featurenow fails: a subtotal of7where11is expected. - Set breakpoints (click the gutter, or
⌘F8/Ctrl+F8):interop/Helper.javaline 16,cart.featureline 20,invoice.jsline 4. - In
ApiTest.java, click ▶ in the gutter next toclass ApiTest→ Debug 'ApiTest', as you would debug any JUnit test. - The one session stops at each breakpoint in turn. In
Helper.java, a Java breakpoint called from a feature: Variables showsarg = "hello world". Resume (⌘⌥R/F9):cart.featureline 20, withcartandtaxRate. Resume:invoice.jsline 4, withitems,taxRateandsubtotal = 7. - Evaluate (
⌥F8/Alt+F8)items[0].price * items[0].qty:6, while the changed line added only the price,2. - Stop the session (
⌘F2/Ctrl+F2).
Breakpoints also work in JavaScript inside a * def docstring, such as line 14 of cart.feature. Debugging needs IDE Pro.
7. Fix, Step Back, Play It Again
A JUnit session reads features and .js files from target/test-classes, so it does not see an edit until a rebuild. To fix and replay in the same session, debug the scenario from the feature:
- Remove the earlier breakpoints and set one on
cart.featureline 25 (* match bill == …). - Click ▶ in the gutter next to the
Scenario→ Debug. It pauses at line 25; Variables showsbillwithsubtotal: 7. - In
invoice.js, restoreitem.price * item.qtyand save. - In the Debug tool window, open the ⋮ (More) menu and choose Step Back, twice: the session pauses at line 23,
* def invoice = read('invoice.js'). - Step Over (
F8) twice. Line 23 re-reads the fixedinvoice.js; back at line 25,billshowssubtotal: 11. - Resume: the test tree turns green. No restart.
To change a step in the feature itself, edit it while paused, choose Hot Reload from the same ⋮ menu, then Step Back and step forward to run it again.
8. Open the Report
Each run writes target/karate-reports/karate-summary.html; the Run console prints its link. Open it in your browser and click cart.feature to see each step, with the failing step's error.
Leave the feature's report page open while you work. After each fix and re-run, reload the page (⌘R / F5) and watch red turn green, without navigating from the summary again.
Prefer the Command Line?
./mvnw test
This runs ApiTest, which starts the app and runs the API suite (features tagged @external, which call public sites, are left out). It needs no sign-in. See JUnit.
Plans
- IDE Plus runs your tests in the editor: gutter ▶, run configurations, single
Examplesrows, run a folder. - IDE Pro adds the debugger (Java and Karate in one session, Step Back, Hot Reload), auto-complete, folding, jump to references and Xplorer Premium.
- Enterprise adds async API testing, concurrent licenses and the license management portal.
Next Steps
- IntelliJ IDEA — every plugin feature and setting
- Debugging — debugging strategies beyond the IDE
- Test Reports — what the HTML report shows