Say I am developing a Shopping cart, BDD, with Cucumber. A cart is rather complex and has many bells-and whistles, but this could be just as well for "a blog" or "a user profile".
I've always considered the "cart" to be the Feature and the bells-and-whistles to be the Scenario's. However, this can make large Feature files and goes against the literal meaning of a Scenario. Here is how that would look:
Feature: Cart
So that I can buy items
As a user
I want to place items in a cart
#.... Many more scenarios
Scenario: Empty a filled cart
Given 2 products in my cart
When I visit the cart page
And I press "Empty cart"
Then I should see the text:
"""
Your cart is empty.
"""
Scenario: Empty an empty cart
Given 0 products in my cart
When I visit the cart page
Then I should not see the "Empty cart" button
# Many more Scenario's
The more details are filled out, the longer this "empty cart" group becomes. I wonder, should "emptying cart" be considered a standalone Feature? This would lead to many Features, all containing but a few Scenario's. The Scenario's then become more like "contexts". Like so:
Feature: Emptying Cart
So that I can reconsider my shopping-spree
As a user
I want to empty my cart
Scenario: with a filled cart
Given 2 products in my cart
When I visit the cart page
And I press "Empty cart"
Then I should see the text:
"""
Your cart is empty.
"""
Scenario: with an empty cart
Given 0 products in my cart
When I visit the cart page
Then I should not see the "Empty cart" button
What is a good guideline for making something a Feature? When should I regroup Scenario's into their own Feature? How many Scenario's does a Feature commonly have?