Skip to content

V2 Refactor 2024

Peter Thomas edited this page Feb 14, 2024 · 23 revisions

Installation

  • Download plugin (3MB ZIP file) from here
  • In IntelliJ, go to Settings -> Plugins. Click on the "gear" icon and Install plugin from disk.

image

You will have to activate the plugin, following instructions below. After you are done trying it out, you may need to switch back to the "stable" version of the plugin to continue your work. You can uninstall the plugin from Settings -> Plugins and then re-install the Karate plugin from the IntelliJ Marketplace.

You can also consider installing the new plugin into IntelliJ Community Edition if want to keep your workspace in IntelliJ IDEA separate.

Activation

Now License Activation and status is unified within the IntelliJ settings UI. Go to Settings -> Languages & Frameworks -> Karate.

image

Click the Sign In link and you will be taken through the usual flow linked to your existing subscription details. Once you have authenticated successfully, copy the session ID from the browser and paste it into the input-box now showing in the IntelliJ settings view. Click Apply to complete the sign-in.

Highlights

  • Parser re-written from the ground-up, that includes JS support
  • Faster and more responsive because plugin does not delegate to multiple "embedded languages"
  • Run and Debug from Karate Feature, or specific Scenario.
  • Karate break-points work even within a "standard" Java debug session (requires Karate 1.5.0.RC3 or greater)
  • Lightweight 3MB instead of 60MB
  • JS syntax coloring works even in IntelliJ Community Edition
  • Right-click and Run all Karate tests in folder
  • Re-designed Run Configuration UI and options
  • JS and JSON brace-matching
  • Option to apply a license completely offline, without needing internet access (air-gapped), which is of interest for enterprises with strict security compliance needs
  • Bring up the Karate license status at any time, which shows you how many days are left in your offline session
  • (19) Code Formatting
  • (19) Compatible with versions of IntelliJ from 2021
  • (21) Click to navigate to called files - Java.type() and read() argument

Coming Soon

  • Variable references
  • Right-click to run only 1 row within Examples:
  • Special re-formatting of JSON (convert to single-line / multi-line, simplify)
  • Paste cURL command and instantly convert to Karate snippet
  • Better auto-complete in JS contexts (e.g. karate.)
  • Better auto-complete in file contexts (e.g. read, karate.call())
  • Deep OpenAPI / Swagger support
  • Hover over code during a debug session to see values
  • (Feasibility to be confirmed) Debug JavaScript within Karate features

Removed

  • Postman Import

Evaluation Tips

  • Open the most complex scripts you have
  • Are all JavaScript syntax and keywords parsed correctly
  • Try to step-through and debug a Karate feature
  • Start a debug session from a Java entry-point (e.g. JUnit test using the Karate Runner API) and see if break-points in Karate feature-files work.
    • Note: requires Karate 1.5.0.RC3 or greater
    • If you need a sample project, use: karate-todo (karate-1.5 branch). Set a break-point in app/api/simple/simple.feature and run app/api/ApiTest.java (JUnit test) in debug mode.
  • Code Folding
  • Are the syntax color choices okay and aligned to what you are used to
  • After you run a test, does clicking on the HTML report link in the console open a browser-window correctly ? This may not work on very old versions of IntelliJ
  • Does code-formatting (Code --> Reformat Code / File) work correctly? Do the Scenario and Examples sections etc. "nest" correctly. What about doc-string blocks within triple-quotes.
Clone this wiki locally