Skip to content

IDE Support

Peter Thomas edited this page Oct 28, 2020 · 34 revisions

Many popular text editors such as Visual Studio Code have support for the Gherkin syntax. Using a Java IDE with Cucumber-JVM support is recommended for the best developer experience. All the options below provide syntax-coloring and the ability to run a test without writing a single line of Java code. And in IntelliJ and Eclipse you will get the JUnit HTML report.

IntelliJ Community Edition

Refer to this video for clear instructions, skip to 3:45 if needed: Getting Started.

  • install only the "Cucumber for Java" plugin and this will automatically prompt you to install the "Gherkin" plugin as well which is required.
  • do NOT install the Substeps IntelliJ Plugin, make sure you un-select it if you see it selected anywhere when it comes to installing a plugin.
  • you will be able to right-click on a *.feature file and run it via the [Run 'Feature:'] menu option
  • you will even able to select a Scenario in the editor view and right-click and run it via the [Run 'Scenario:'] menu option
  • if you see warnings such as Unimplemented substep definition - refer to this ticket

IntelliJ IDEA

  • the needed plugins are already installed, see above for troubleshooting

Eclipse

  • install the free Cucumber-Eclipse plugin from https://cucumber.io/cucumber-eclipse/
  • then you will be able to right-click within any *.feature file and [Run As -> Cucumber Feature]
  • Refer to the Cucumber-Eclipse wiki for more: http://bit.ly/2mDaXeV
  • If you see warnings such as Step 'xxx' does not have a matching glue code or required(..)+ loop did not match anything at input Scenario: - refer to this ticket

Visual Studio Code

You can choose to install just syntax support such as this one. But for the best experience, read on below.

VS Code Karate Plugin

The Karate Plugin created by Kirk Slota supports the stand alone JAR executable (see video). It also works with standard Maven projects (or Gradle projects with some tweaks) and you can switch between other Java IDE-s if you want.

The best part about this plugin is a "native" step-through and debug experience (see video). You can even step back during a session, re-play steps and even edit and hot-reload code at the same time !

If you run into issues, you can find additional instructions here: Karate Robot Windows Install Guide - and note that a common source of problems is using Powershell which is the "Default Shell" for VS Code. Switch to cmd instead.

To get the best experience after installing Visual Studio Code we suggest the following extension if you use Java + Maven. To configure, go to the View Menu -> Extensions.

Other Useful Links

Soumendra Daas has created a nice example and guide that you can use as a reference here: hello-karate. This demonstrates a Java Maven + JUnit4 project set up to test a Spring Boot app.

Another blog post which is a good step-by-step reference is this one by Micha Kops - especially if you use the 'default' maven folder structure instead of the one recommended in the Karate documentation.

And one more up-to-date and useful reference is this step-by-step guide by Andy Knight using Visual Studio Code instead of Eclipse or IntelliJ.