</>

Technology

Cucumber

Difficulty

Beginner

Interview Question

What is the file extension for a Cucumber feature file?

Answer

Feature File Extension

Extension: .feature

Cucumber feature files use the .feature extension.

CODE
login.feature
registration.feature
checkout.feature
shopping_cart.feature

Key Facts

  • Format: Plain text (UTF-8 encoded)
  • Editor: Any text editor, IDE with Cucumber plugin
  • Location: src/test/resources/features/ (Maven convention)
  • Readable by: Anyone — no programming knowledge needed
  • Ideally saved in: A notepad-type file structure (plain text)

Standard Project Structure

CODE
src/
  test/
    resources/
      features/
        login.feature           ← feature files here
        registration.feature
        checkout.feature
    java/
      stepDefinitions/
        LoginSteps.java
        RegistrationSteps.java
      hooks/
        Hooks.java
      runners/
        TestRunner.java

IDE Support

To get syntax highlighting for .feature files:

IDEPlugin
IntelliJ IDEACucumber for Java (bundled in Ultimate)
EclipseCucumber Natural Language Plugin
VS CodeCucumber (Gherkin) Full Support

Example File Content

Gherkin
# File: src/test/resources/features/login.feature

Feature: User Authentication
  Scenario: Valid login
    Given the user is on the login page
    When the user enters valid credentials
    Then the dashboard should be displayed

The first line comment after # is optional and ignored by Cucumber. The actual feature content starts with the Feature: keyword.

Follow AutomateQA

Related Topics