I've read Specification by Example and several BDD articles, which all say to avoid details like specific form fields in the feature description and scenarios. But if the specification of which form fields we need and what validations are appropriate is not in the examples, where is it?
I am considering putting all the form fields in the scenarios, along with having a scenario for each validation. It seems like a lot of overhead; is there a better way?
EDIT: For example, take the following.
Feature: Add new product
In order to sell a new product on our website
As an internal user
I want to add the product to our catalog
Scenario: Successful addition
Given I am logged in
When I try to add a new product
And I provide "Widget" as the name
And I provide 1 lb. as the weight
And I provide 1 inch as the height
And I provide 2 inches as the width
And I provide 3 inches as the length
Then I see the new product that was added
Scenario: Duplicate name
Given I am logged in
And an existing product named "Dupe"
When I try to add a new product
And I provide "Dupe" as the name
Then I see a duplicate name error
Scenario: Invalid Weight
Given I am logged in
When I try to add a new product
And I provide -1 as the weight
Then I see an invalid weight error
Scenario: Invalid Height
Given I am logged in
When I try to add a new product
And I provide -1 as the height
Then I see an invalid height error
Scenario: Invalid Width
Given I am logged in
When I try to add a new product
And I provide -1 as the width
Then I see an invalid width error
Scenario: Invalid Length
Given I am logged in
When I try to add a new product
And I provide -1 as the length
Then I see an invalid length error
The key is to remove all things from the scenarios that are unrelated the specific test. They are just noise that distract from the point. The details should be in the step definitions.
For example, let's take this one:
Scenario: Successful addition
Given I am logged in
When I try to add a new product
And I provide "Widget" as the name
And I provide 1 lb. as the weight
And I provide 1 inch as the height
And I provide 2 inches as the width
And I provide 3 inches as the length
Then I see the new product that was added
There is a lot of repetition here, and it is not at all "conversational" in style--you wouldn't explain how it works using language like this. The specific dimensions are being given but for no reason--you will have other tests that check size boundaries. The size isn't being tested here. You could easily change this to:
Given I am logged in
When I try to add a new product named "Widget"
And specify the weight and dimensions
Then I see the new product that was added
This is closer to how you'd describe the test to others, and hides the details in the step definitions.