Verisoft Wiki

When writing Steps in Cucumber, parameters are often used to make Step Definitions more flexible.
To facilitate step writing and improve parameter usage, a tool has been developed that provides built-in parameter completion suggestions.

Installation

  1. Download the JAR file:

If you don’t find the match version, tha you can Change the IntelliJ version:

***
version = "YOUR.VERSION"
***
intellij {
  version.set("YOUR.VERSION")
}
***
  1. Move the JAR file to a convenient location on your computer.

  2. Installing the Plugin in IntelliJ

    • Open IntelliJ IDEA.
    • Navigate to File → Settings → Plugins.
    • Click Install Plugin from Disk.
    • Select the JAR file you saved on your computer.
    • Click Apply, then OK.
    • Restart IntelliJ for the changes to take effect.

Tool Implementation Requirements:

  1. Create a new class named CucumberParameterDefinitions inside the co.verisoft.fw.cucumber package, where all parameter names will be defined.

  2. For each parameter:

    • Define a name for the parameter, e.g., direction.
    • Add a function inside the CucumberParameterDefinitions class to define the parameter, for example:
package co.verisof.fw.cucumber;
import io.cucumber.java.ParameterType;

public class CucumberParameterDefinitions {
    @ParameterType("UP|DOWN|RIGHT|LEFT")
    public String direction(String string) {
        return string; 
    }
}
  1. The parameter can then be used in a step like this:

    @Then("user scrolls the screen to {direction} direction")
    public void userScrollsTheScreenToDirection(String directionString) {
        //scroll the screen to the specified direction
    }
    

How to Use the Tool:

When writing a scenario, if the user places the cursor on a parameter inside curly braces {} and presses CTRL + P, IntelliJ’s built-in suggestion popup will appear, allowing quick and easy selection of the desired parameter.

ℹ️ Info: Remember To Save your CucumberParameterDefinitions file after updating it.
If not, the plugin won’t recognize the parameter name