October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk6 min

How to Configure Cucumber in Eclipse and IntelliJ IDEA

Configure Cucumber-JVM for Eclipse or IntelliJ IDEA: align dependencies, choose the right JUnit integration, run feature files, and fix common discovery problems.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To configure Cucumber in Eclipse or IntelliJ IDEA, add the matching Cucumber-JVM dependencies and test runner to your Java project, then use the IDE’s Cucumber integration to run a feature file. The plugin helps the IDE understand Gherkin and launch tests; it does not replace the project dependencies. Keep all Cucumber modules on the same version, and choose the JUnit 4 integration or JUnit 5 platform engine to match your project.

Set up Cucumber in the Java project first

Use an existing Maven or Gradle Java project, or create one before configuring the IDE. Add io.cucumber:cucumber-java in test scope and one runner integration appropriate for the project’s test platform. Cucumber’s installation guide documents Maven and Gradle setup and advises using the same version for Cucumber dependencies. Its reference describes execution through JUnit 4, JUnit 5, build tools, IDEs, and the CLI.

As an Amazon Associate I earn from qualifying purchases.

Maven dependencies

For JUnit 4, add the Java module and Cucumber’s JUnit 4 integration. Set cucumber.version to one Cucumber version used by both dependencies. The property below is a value you must supply, not a literal version:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
<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>
</dependencies>

For a JUnit 5 project, use cucumber-junit-platform-engine rather than copying the JUnit 4 integration as though it were interchangeable. Follow the project’s existing JUnit Platform setup and Cucumber’s installation guide for its matching dependencies and build-tool configuration. A JUnit 5 project that needs to run JUnit 4 tests may use a Vintage engine, but that is a separate compatibility choice; cucumber-junit itself is based on JUnit 4.

Gradle dependency pattern

The equivalent test-scoped setup uses the same Cucumber version for each Cucumber artifact. Choose one integration that matches the test platform:

def cucumberVersion = 'YOUR_CUCUMBER_VERSION'

dependencies {
    testImplementation "io.cucumber:cucumber-java:$cucumberVersion"

    // Choose this for a JUnit 4 project:
    testImplementation "io.cucumber:cucumber-junit:$cucumberVersion"

    // For a JUnit 5 project, use cucumber-junit-platform-engine
    // instead of cucumber-junit, with the project's JUnit Platform setup.
}

Do not leave both runner choices in the build by default. Cucumber does not bundle an assertion library; use the assertions provided by your chosen testing library.

JUnit 4 runner example

With cucumber-junit, create a test runner class such as:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import org.junit.runner.RunWith;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;

@RunWith(Cucumber.class)
@CucumberOptions(
    features = "src/test/resources",
    glue = "com.example.steps"
)
public class RunCucumberTest {
}

Change features to the location of your feature files and glue to the Java package containing your step definitions. This runner is for the JUnit 4 integration; do not use it as the JUnit 5 runner configuration.

Configure Cucumber in Eclipse

  1. Install Cucumber-Eclipse from Eclipse Marketplace, or use the project’s documented update site: https://cucumber.github.io/cucumber-eclipse/update-site.
  2. Ensure the Java project has the Cucumber-JVM dependencies and runner integration described above. Let the build tool resolve them before diagnosing an IDE-only failure.
  3. Create a .feature file in the project and add a Gherkin scenario.
  4. Select the feature file and use Run > Run to invoke Cucumber-JVM. The plugin creates a run configuration for that invocation.
  5. To adjust or rename it, open Run > Run Configurations and inspect its Feature Path and other settings.

Run a subset of features in Eclipse

The Cucumber-Eclipse project README says its plugin does not provide tag filtering. To run a subset, organize features in directories and set the desired file or directory as the Feature Path in the run configuration. Alternatively, keep the plugin for feature editing and generated step-definition stubs, then run a JUnit runner class such as the one above.

Configure Cucumber in IntelliJ IDEA

  1. Install or enable the Cucumber for Java plugin. The official Cucumber Java tutorial identifies it for its IntelliJ getting-started path. Plugin availability and IDE compatibility can change, so check the live JetBrains Marketplace listing for the installed IntelliJ IDEA release.
  2. Confirm the project itself has cucumber-java and the runner integration matching its JUnit setup. Installing the IDE plugin alone does not add those dependencies.
  3. Open Run > Edit Configurations, add a Cucumber Java configuration, and set the feature file or directory to run.
  4. If IntelliJ cannot find step definitions, enter the package containing those Java classes in the configuration’s Glue field. Use a package name such as com.example.steps, not a filesystem path.
  5. Run the configuration and check that its feature selection and Glue value match the project’s actual source and resource locations.

JetBrains may change menu labels or configuration fields between IDE releases. If the installed version’s screen differs, consult the current Cucumber Java run configuration documentation linked from Cucumber’s FAQ.

Choose the correct runner and verify discovery

Project test platform Cucumber integration Important distinction
JUnit 4 cucumber-junit Uses a runner class annotated with @RunWith(Cucumber.class).
JUnit 5 cucumber-junit-platform-engine Uses the JUnit Platform; do not assume the JUnit 4 runner applies.
JUnit 5 project that also runs JUnit 4 tests JUnit Platform engine plus an appropriate Vintage setup if needed The Cucumber JUnit 4 integration remains based on JUnit 4.

Run the same tests through Maven or Gradle as well as through the IDE. If the build-tool run fails too, fix the project configuration before treating it as an IDE discovery problem. For Maven, inspect resolved dependencies with:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
mvn dependency:tree

Troubleshoot common configuration failures

  • IDE says Cucumber classes or annotations cannot be resolved: confirm the build tool has imported the test dependencies and that cucumber-java is present in test scope.
  • NoSuchMethodException or an old runtime class appears: inspect mvn dependency:tree for conflicting transitive Cucumber versions, then align all Cucumber modules.
  • A JUnit runner does not launch: check whether the project uses JUnit 4 or JUnit 5. Use cucumber-junit and @RunWith for the JUnit 4 path; use the JUnit Platform engine for JUnit 5.
  • IntelliJ reports undefined steps: set the correct Java package in the Cucumber Java configuration’s Glue field and ensure the step classes are in the test sources.
  • Eclipse runs the wrong scenarios or none: inspect the generated run configuration’s Feature Path and point it at the intended feature file or directory.
  • Build-tool run works but IDE run fails: check the IDE’s configuration fields and whether its project model has reloaded the latest dependencies.
  • Environment variables are missing only in IDE runs: set them in the IDE run configuration; variables set in a separate shell are not automatically the IDE-launched process environment.
  • A Ruby Cucumber instruction does not work for Cucumber-JVM: do not assume Ruby profiles or .env files configure the JVM implementation. Cucumber documents that JVM profiles are unavailable and that JVM configuration does not use an env file; use the JVM-supported configuration mechanisms instead.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

This Cucumber setup does not require a screenshot service. If a separate development task needs a website screenshot, ScreenshotNeo is a website screenshot API with an MCP server. Its request can return a PNG, JPEG, WebP, or PDF; the example below saves a WebP response for a target URL.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for request options. It removes cookie and consent banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. Its MCP server provides screenshot tools for AI agents. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.

Sign up for ScreenshotNeo’s free plan.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.