IntelliJ IDEA 2017.1 Help

Enabling Cucumber Support in Project

In this section:


Make sure that Cucumber for Java and/or Cucumber for Groovy bundled plugins are enabled. The choice of plugin depends on the type of step definitions to be generated.

Two ways of creating Cucumber dependencies

Cucumber dependencies can be defined in two different ways:

  • Using Maven dependencies
  • Using libraries

Using Maven dependencies

To enable Cucumber in a Maven project, follow these general steps

  1. Create a project from scratch, and select module type Maven. Alternatively, just add a Maven module.

    Do not create a Maven module from archetype!

  2. Open for editing pom.xml file of the new project or module.
  3. In the pom.xml, create and expand the section dependencies, and add the following code:
    <dependency> <groupId>info.cukes</groupId> <artifactId>cucumber-java</artifactId> <scope>test</scope> <version>1.0.11</version> </dependency> <dependency> <groupId>info.cukes</groupId> <artifactId>cucumber-jvm</artifactId> <version>1.0.11</version> <type>pom</type> </dependency>
  4. Run the phase package to include all dependencies.

Using libraries

To enable Cucumber support via libraries, follow these general steps

  1. In a project where Cucumber tests should be created, click /help/img/idea/2017.1/projectStructure.png. Project Structure dialog box opens.
  2. In the Modules page, click Dependencies tab, and add the required Maven dependencies:
    1. Click add, and choose Libraries from the submenu.

      If the libraries already exists locally, then in the Choose Libraries dialog box, select the desired version of the library cucumber-java (for Java) or cucumber-groovy (for groovy), and click the button Add Selected.

      If the library does not yet exist locally, click New Library, and select library type From Maven. Then, in the Download Library from Maven Repository dialog box, specify the Maven coordinates (if known), or a keyword, select the target for downloading, and click OK.

      Configure the new library as required (for example, attach documentation URL or sources).

    2. In the Scopes column, click the arrow to reveal the drop-down list, and select Tests.
  3. Apply changes and close the Project Structure dialog box.

See Also

Last modified: 18 July 2017