Feature Files
Organizing your feature files well makes tests easier to find, maintain, and understand.
Directory Structure
One Feature Per File
Each feature file should focus on a single feature:
tests/Behaviors/
├── authentication/
│ ├── login.feature
│ ├── logout.feature
│ └── password-reset.feature
├── cart/
│ ├── add-items.feature
│ ├── remove-items.feature
│ └── checkout.feature
└── admin/
├── user-management.feature
└── reports.featureGroup by Domain
Organize by business domain, not technical concerns:
# Good: Domain-based
tests/Behaviors/
├── orders/
├── payments/
├── shipping/
└── customers/
# Avoid: Technical grouping
tests/Behaviors/
├── api/
├── database/
├── ui/
└── services/Naming Conventions
File Names
Use lowercase with hyphens, describing the behavior:
# Good
user-registration.feature
shopping-cart-checkout.feature
password-reset-flow.feature
# Avoid
test1.feature
users.feature
misc.feature
UserRegistration.featureFeature Names
Be specific about what the feature does:
gherkin
# Good
Feature: Shopping Cart Checkout
Feature: Password Reset via Email
Feature: Admin User Management
# Avoid
Feature: Cart
Feature: Password
Feature: Admin StuffFeature Descriptions
User Story Format
Include who, what, and why:
gherkin
Feature: Shopping Cart Checkout
As a customer
I want to complete my purchase
So that I can receive my ordered productsFree-Form Description
Or use prose for complex features:
gherkin
Feature: Credit Application Processing
Agricultural credit applications are evaluated based on
the farmer's land holdings. The minimum land requirement
is 5 hectares per 10,000 TL of requested credit.
Applications exceeding the land-to-credit ratio are
automatically rejected. Approved applications proceed
to the verification stage.Combined Approach
gherkin
Feature: Order Fulfillment
As a warehouse manager
I want orders to be automatically assigned to pickers
So that fulfillment is efficient and trackable
Orders are assigned based on picker availability and
proximity to the items. Priority orders (next-day delivery)
are assigned first, followed by standard orders.Tag Organization
Feature-Level Tags
Apply to all scenarios in the file:
gherkin
@api @orders @critical
Feature: Order Processing
...Scenario-Level Tags
For specific scenarios:
gherkin
Feature: User Authentication
@smoke @fast
Scenario: Successful login
...
@edge-case @slow
Scenario: Login with expired session
...Standard Tag Conventions
| Tag | Purpose |
|---|---|
@smoke | Critical path tests |
@slow | Tests taking > 5 seconds |
@wip | Work in progress |
@skip | Temporarily disabled |
@P1, @P2, @P3 | Priority levels |
@regression | Regression suite |
@api, @ui, @integration | Test type |