How to Configure Cucumber in Eclipse and IntelliJ
Set up Cucumber-JVM for Eclipse or IntelliJ IDEA, choose the right JUnit runner, run a feature, and fix missing step definitions.
To configure Cucumber in Eclipse or IntelliJ IDEA, add Cucumber-JVM and the runner that matches your project’s JUnit version, then install the IDE’s Cucumber plugin and point the run configuration at your feature files and step-definition package. The plugin helps the IDE understand and run feature files; it does not replace the Java dependencies in your project.
1. Set up the Java project and choose a runner
Start with a Java project managed by Maven or Gradle. Add cucumber-java in test scope and choose one runner integration: cucumber-junit for JUnit 4, or cucumber-junit-platform-engine for JUnit 5. Keep all Cucumber artifacts on the same version. Do not add both integrations just to make the IDE recognize features.
These Maven examples use the placeholder ${cucumber.version}; define it as a single version shared by the Cucumber dependencies. Add the JUnit dependency appropriate to the selected integration if your project does not already provide it.
Maven dependencies: JUnit 4
<properties>
<cucumber.version>YOUR_CUCUMBER_VERSION</cucumber.version>
</properties>
<dependencies>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>YOUR_JUNIT4_VERSION</version>
<scope>test</scope>
</dependency>
</dependencies>
A minimal JUnit 4 runner class is:
package example;
import org.junit.runner.RunWith;
import io.cucumber.junit.Cucumber;
@RunWith(Cucumber.class)
public class RunCucumberTest {
}
Maven dependencies: JUnit 5
<properties>
<cucumber.version>YOUR_CUCUMBER_VERSION</cucumber.version>
</properties>
<dependencies>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit-platform-engine</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
Use your project’s JUnit Platform setup and test launcher/build-tool configuration. The JUnit 4 @RunWith runner is not the JUnit 5 engine. If you need to run JUnit 4 tests on the JUnit Platform, that is a separate Vintage-engine choice; do not confuse it with Cucumber’s JUnit 5 engine.
Gradle dependency shape
For Gradle, use test-scoped dependencies and align the Cucumber versions in the same way. Select the integration that matches your project:
dependencies {
testImplementation "io.cucumber:cucumber-java:${cucumberVersion}"
// Choose one integration:
testImplementation "io.cucumber:cucumber-junit:${cucumberVersion}" // JUnit 4
// or: testImplementation "io.cucumber:cucumber-junit-platform-engine:${cucumberVersion}" // JUnit 5
}
Also include the project’s JUnit dependency and configure its build tool to run the chosen test platform. Cucumber does not bundle an assertion library; use assertions from the test library already selected by the project. See the [Cucumber Java installation guide](https://cucumber.io/docs/installation/java/) and [Cucumber reference](https://cucumber.io/docs/cucumber/api/) for the current dependency and runner details.
2. Configure Cucumber in Eclipse
- Install Cucumber-Eclipse from Eclipse Marketplace or the project update site: https://cucumber.github.io/cucumber-eclipse/update-site.
- Import or create the Maven/Gradle Java project and let Eclipse resolve its test dependencies.
- Create a
.featurefile under your test resources. For example,src/test/resources/features/account.feature. - Right-click the feature or open it, then use Run > Run to invoke Cucumber-JVM.
- Open Run > Run Configurations to inspect, rename, or edit the generated run configuration. Confirm its Feature Path points to the intended file or directory.
The Cucumber-Eclipse README documents feature-file execution and run configurations. It also says tags are not available in the plugin; to select a subset, organize features in directories and choose the relevant Feature Path. Another supported workflow is to keep the plugin for feature editing and generated step-definition stubs, then run a JUnit runner class such as the one above. See the [Cucumber-Eclipse project instructions](https://github.com/cucumber/cucumber-eclipse).
3. Configure Cucumber in IntelliJ IDEA
- Install or enable the Cucumber for Java plugin. Check the current Marketplace listing for compatibility with your installed IDEA version; plugin support changes over time.
- Open the Maven or Gradle project and wait for dependency import to finish. Confirm the Cucumber-JVM dependencies and the matching JUnit integration are present.
- Open Run > Edit Configurations, add a Cucumber Java configuration, and set the feature file or feature directory.
- If step definitions are not detected, set the Glue field to the Java package containing them, such as
example.steps. Use the package name rather than a filesystem path. - Save and run the configuration. If the IDE’s menu names differ, consult the current [JetBrains Cucumber Java run configuration documentation](https://www.jetbrains.com/help/idea/run-debug-configuration-cucumber-java.html).
The [Cucumber FAQ](https://cucumber.io/docs/faq/) specifically recommends configuring Glue when IntelliJ cannot find step definitions. The plugin provides IDE support, while the project’s dependencies and runner determine whether Cucumber-JVM can execute.
4. Confirm the feature, glue, and runner work
Use a minimal feature and step definition to check discovery before adding application-specific code. Keep the feature path and Java package consistent with your project structure.
# src/test/resources/features/account.feature
Feature: Account status
Scenario: Check account status
Given the account is active
Then its status is active
// src/test/java/example/steps/AccountSteps.java
package example.steps;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
public class AccountSteps {
private boolean active;
@Given("the account is active")
public void theAccountIsActive() {
active = true;
}
@Then("its status is active")
public void itsStatusIsActive() {
if (!active) {
throw new AssertionError("Expected an active account");
}
}
}
For JUnit 4, run the runner class. For JUnit 5, run the project through its configured JUnit Platform engine. Also run through the build tool or CLI path used by the project. Cucumber supports execution through build tools, CLI, JUnit, and IDEs; a command-line success paired with an IDE failure usually narrows the problem to IDE configuration or indexing.
5. Diagnose common setup errors
| Symptom | Likely cause | What to check or change |
|---|---|---|
| “Undefined step” or no matching step definition | The glue package was not discovered, the step annotation text differs, or the class is outside test sources. | Set IntelliJ’s Glue field to the step package; in either IDE check the package declaration, annotations, and that the source is included in test scope. |
| The IDE does not offer a Cucumber run action | The IDE plugin is missing/disabled, dependencies have not imported, or the file is not recognized as a feature. | Enable/install the IDE plugin, refresh Maven/Gradle, confirm the file ends in .feature, then create a run configuration explicitly. |
| Feature opens but no scenarios run | The selected feature path is wrong or the runner/configuration points at another directory. | Inspect Eclipse’s Feature Path or IntelliJ’s feature path, and verify the feature is under the expected test resources directory. |
NoSuchMethodException or runtime linkage errors |
Cucumber artifacts resolve to incompatible versions, often through a transitive dependency. | Align all Cucumber module versions. For Maven inspect mvn dependency:tree, identify older transitive artifacts, and resolve the version conflict. |
| JUnit 5 project does not run a JUnit 4 Cucumber runner | cucumber-junit is based on JUnit 4 and does not itself configure the JUnit 5 engine. |
Use cucumber-junit-platform-engine for the JUnit 5 project, or deliberately configure Vintage if the project must execute JUnit 4 tests on the platform. |
| Works in a shell, fails when launched by the IDE | The IDE run configuration has a different working directory, environment, classpath, or feature path. | Compare the configuration fields and set required environment variables in the IDE run configuration itself. |
| Feature editor has no syntax support | The corresponding IDE plugin is absent, disabled, or incompatible with the installed IDE. | Check plugin status and current compatibility. Execution can still be verified through the build tool independently. |
Do not apply Ruby Cucumber profile or .env instructions to Cucumber-JVM. The JVM configuration documentation says profiles are unavailable for JVM, and the environment-variable guidance says JVM configuration through an env file is unsupported. Use the documented JVM configuration mechanisms and IDE run configuration fields instead; see [Cucumber configuration](https://cucumber.io/docs/cucumber/api/) and the [environment variable documentation](https://cucumber.io/docs/cucumber/environment-variables/).
6. Compare the Eclipse and IntelliJ workflows
| Task | Eclipse | IntelliJ IDEA |
|---|---|---|
| IDE integration | Cucumber-Eclipse from Marketplace or the project update site. | Cucumber for Java plugin; confirm current Marketplace compatibility. |
| Run one feature | Run the feature; inspect the generated run configuration. | Create a Cucumber Java run configuration and choose the feature. |
| Run a subset | Plugin README reports tags are unavailable; select a feature path/directory. | Use the run configuration and the runner options appropriate to the Java test platform. |
| Common discovery fix | Check Feature Path and resolved project dependencies. | Set Glue to the step-definition package if automatic discovery fails. |
Both IDEs rely on the same core setup: compatible Cucumber artifacts, the right runner, and discoverable feature and glue paths. Use the build tool as a baseline when IDE behavior is unclear.
7. Performance, reliability, and cost
IDE plugins are useful for editing and launching scenarios, but the build tool is the repeatable baseline for local and continuous integration runs. Keep Cucumber dependencies aligned to avoid runtime surprises, and avoid loading unnecessary features when narrowing a failing run. The supplied setup documentation does not establish a numeric performance difference between Eclipse and IntelliJ, so choose based on the IDE your team already uses and its current plugin compatibility.
The documented setup uses open-source IDE integrations and Java dependencies; the dossier does not establish a required paid product for configuring Cucumber. Dependency downloads and scenario runtime still depend on the project and its build environment.
8. Or skip the browser setup
If your development workflow also needs website screenshots—for example, to document a feature or inspect a rendered page—you can call ScreenshotNeo, a website screenshot API and MCP server from Yorker Media. See the API documentation.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
Cookie banners, popups, and chat widgets are removed before the shot. Bot checks, blank pages, and failed loads are never billed. An MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for free.
FAQ
Do I need both the Eclipse or IntelliJ plugin and Cucumber-JVM dependencies?
The plugin supplies IDE integration. Your Java project still needs Cucumber-JVM and the runner or engine matching its test platform.
Can I use JUnit 4 and JUnit 5 Cucumber integrations together?
Choose the integration for the project’s test platform. Add a Vintage engine only when the project intentionally needs to run JUnit 4 tests on JUnit Platform.
Where should step definitions live?
Put them in the project’s test source tree and in a Java package included by the runner’s glue discovery. In IntelliJ, enter that package in Glue if automatic discovery misses it.
How can I tell whether the issue is the IDE or the project?
Run the same test through Maven or Gradle. If that succeeds, compare the IDE’s feature path, Glue, environment, and selected runner with the project configuration.


