Skip to content

Instantly share code, notes, and snippets.

@jwieringa
Created March 9, 2012 21:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwieringa/2008818 to your computer and use it in GitHub Desktop.
Save jwieringa/2008818 to your computer and use it in GitHub Desktop.
Cucumber Example
# Below is an example of a User Story turned into a Cucumber feature
User Story
----------
As a <Insert Role>
I want <The Tool>
So that <Insert Business Value>
If a customer enters a credit card number that isn’t exactly 16 digits long, when they try to submit the form, it should be redisplayed with an error message advising them of the correct number of digits.
Cucumber Feature
-----------------------
Feature: Feedback when entering invalid credit card details
In user testing we've seen a lot of people who made mistakes entering their credit card. We need to be as helpful as possible here to avoid losing users at this crucial stage of the transaction.
Background:
Given I have chosen some items to buy
And I am about to enter my credit card details
Scenario: Credit card number too short
When I enter a card number that's only 15 digits long
And all the other details are correct
And I submit the form
Then the form should be redisplayed
And I should see a message advising me of the correct number of digits
Scenario: Expiry date invalid
When I enter a card expiry date that's in the past
And all the other details are correct
And I submit the form
Then the form should be redisplayed
And I should see a message telling me the expiry date must be wrong
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment