This feature is supported in the Ultimate edition only.
IntelliJ IDEA supports integration with the Cucumber.js test framework
.
IntelliJ IDEA recognizes features
written in the Gherkin
language.
On this page:
Before you start
-
Make sure the Node.js
runtime environment
is installed on your computer.
- Install and enable the NodeJS, Cucumber.js, and Gherkin repository plugins on the Plugins page as described in Installing, Updating and Uninstalling Repository Plugins and Enabling and Disabling Plugins.
Installing Cucumber.js
Open the built-in IntelliJ IDEA Terminal (press ⌥F12⌥F12⌥F12⌥F12⌥F12 or choose on the main menu) and type one of the following commands at the command prompt:
-
npm install cucumberfor local installation in your project. -
npm install -g cucumberfor global installation. -
npm install --save-dev cucumberto install Cucumber.js as a development dependency
.
.
You can also install the cucumber package on the Node.js and NPM page
as described in NPM.
Running tests
Cucumber.js tests are launched only through a run/debug configuration.
To create a Cucumber.js run configuration
-
Open the Run/Debug Configuration dialog box
( on the main menu).
Alternatively, select a test file in the Project tool window and choose Create <file name> on the context menu.
-
Click
on the toolbar and select Cucumber.js from the list.
The Run/Debug Configuration: Cucumber.Js dialog box opens.
-
In the Feature file or directory text box, specify the tests to run.
Type the path to a specific
.featurefile or to a folder, if you want to run a bunch of features. -
In the Executable path text box,
specify the location of the
cucumber-js.cmd,cucumber-js.bat, or other depending on your operating system. The location depends on the installation mode. -
Optionally,
specify the command line arguments to be passed to the executable file, such as
-r(--require LIBRARY|DIR),-t(--tags TAG_EXPRESSION), or--coffee. For details, see native built-in help available through thecucumber-js --helpcommand.
To run tests via a run configuration
-
Select the Cucumber.js run/debug configuration from the list on the main toolbar
and click
to the right of the list.
- The test server starts automatically without any steps from your side. View and analyze messages from the test server in the Run tool window.
- Monitor test execution in the Test Runner tab of the Run tool window as described in Monitoring and Managing Tests.
Navigation
With IntelliJ IDEA, you can jump between a file and the related test file. Navigation from a test result in the Test Runner Tab to the test is also supported.
To jump between a file and the related test file
Open the file in the editor and choose or
on the context menu, or just press ⇧⌘T⇧⌘T⌃⇧T⌃⇧T.
The test file should follow popular naming conventions,
e.g. have a .test., .spec. or _spec. suffix and should be located either next to the source file or in a test folder.
To jump from a test result to the test
Select the test name in the Test Runner tab and choose Jump to Source on the context menu.

Debugging tests
A debugging session for Cucumber.js tests is started only through a run/debug configuration.
To start debugging tests
- Create a Cucumber.js run/debug configuration as described above.
-
Select the Cucumber.js run/debug configuration from the list on the main toolbar
and click
to the right of the list.
- In the Debug tool window that opens, proceed as usual: step through the tests, stop and resume test execution, examine the test when suspended, etc.