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:
| IDE | Plugin |
|---|---|
| IntelliJ IDEA | Cucumber for Java (bundled in Ultimate) |
| Eclipse | Cucumber Natural Language Plugin |
| VS Code | Cucumber (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.
