Enabling Cucumber Support in Project
In this section:
Prerequisite
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
To enable Cucumber in a Maven project, follow these general steps
- Create a project from scratch, and select module type Maven. Alternatively, just add a Maven module.
Do not create a Maven module from archetype!
- Open for editing
pom.xml
file of the new project or module. - In the
pom.xml
, create and expand the sectiondependencies
, 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>
- Run the phase
package
to include all dependencies.
Using libraries
To enable Cucumber support via libraries, follow these general steps
- In a project where Cucumber tests should be created, click
. Project Structure dialog box opens.
- In the Modules page, click Dependencies tab, and add the required Maven dependencies:
- Click
, 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) orcucumber-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).
- In the Scopes column, click the arrow to reveal the drop-down list, and select Tests.
- Click
- Apply changes and close the Project Structure dialog box.