IntelliJ IDEA 13.1.0 Web Help

If a .feature file refers to a non-existent step, IntelliJ IDEA's code inspection recognizes and highlights such step, and provides an intention action that helps create missing step definition.

To create a missing step definition
  1. While editing the .feature file, type a reference to a step definition. IntelliJ IDEA highlights step as undefined, and gives detailed information at the tooltip:

    cucumberUndefinedStepInspection

  2. Press Alt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+Enter, Shift+Alt+J or Ctrl+Shift+MAlt EnterAlt EnterCommand 1 to show the Create Step Definition intention action:

    cucumberCreateStepDefinition

  3. Select the target step definition file from the pop-up list:

    cucumberCreateUndefinedStep

    You can either select one of the existing step definition files from the suggestion list, or create a new one.

    If you opt to create a new step definition file, specify its name, type (Java or Groovy), and the parent directory.

    IntelliJ IDEA creates a step definition stub in the specified location.

  4. In the selected step definition file that opens in the editor, enter the desired code. Note that the editor turns into the template editing mode and displays the first input field highlighted with the red frame.

    cucumberCreateUndefinedStep1

    Type step definition in this frame and press EnterEnterEnterEnterEnterEnterEnterEnterEnterEnterEnterEnter or TabTabTabTabTabTabTabTabTabTabTabTab to complete input and pass to the next input field, where you have to enter your source code. After completing input, the caret moves to the end of the suggested step definition, and the editor returns to the regular mode of operation.

Please note the following:

  • You can find usages of a step definition. To do that, place the caret at the desired definition, and press Alt+F7Shift+Alt+7Shift+Alt+7Alt+F7Alt+F7 or Shift+Alt+SAlt+F7 or Ctrl+Shift+EnterShift+Alt+F7Alt+F7Ctrl+GAlt F7Alt F7Shift Command G. Refer to the section Finding Usages in Project for details.
  • 12.0+ IntelliJ IDEA keeps an eye on the uniqueness of the step definitions. Step definitions with the same names are highlighted.

See Also

Concepts:

Procedures:

Reference:

Web Resources: