04_user_story_template.md

Download
markdown 180 lines 5.2 KB
  1# User Story and Acceptance Criteria Template
  2
  3A user story captures a software feature from an end-user perspective.
  4Acceptance criteria define the conditions that must be met for the story to be "done."
  5
  6---
  7
  8## User Story Format
  9
 10```
 11Title: [Short descriptive title]
 12
 13As a [role/persona],
 14I want [feature/capability],
 15So that [benefit/value].
 16
 17Priority: [Must Have / Should Have / Could Have / Won't Have]
 18Story Points: [1 / 2 / 3 / 5 / 8 / 13]
 19Sprint: [Sprint number or Backlog]
 20```
 21
 22## Acceptance Criteria Format (Gherkin / Given-When-Then)
 23
 24```
 25Scenario: [Scenario title]
 26  Given [initial context / precondition]
 27  When  [action performed by user or system]
 28  Then  [expected outcome]
 29  And   [additional outcome] (optional)
 30```
 31
 32---
 33
 34## Example 1: Checkout Flow
 35
 36**Title:** Complete purchase with saved payment method
 37
 38As a returning customer,
 39I want to check out using my saved credit card,
 40So that I can complete my purchase quickly without re-entering payment details.
 41
 42**Priority:** Must Have
 43**Story Points:** 5
 44**Sprint:** Sprint 3
 45
 46### Acceptance Criteria
 47
 48**Scenario 1: Successful checkout with saved card**
 49```
 50Given I am logged in and have items in my cart
 51  And I have at least one saved payment method on file
 52When I proceed to checkout and select my saved card
 53  And I confirm the order
 54Then the order is placed successfully
 55  And I receive an order confirmation email within 2 minutes
 56  And my cart is cleared
 57```
 58
 59**Scenario 2: Saved card is expired**
 60```
 61Given I am logged in and have items in my cart
 62  And my only saved card has expired
 63When I proceed to checkout
 64Then I am prompted to add a new payment method
 65  And my saved card is flagged as expired in my account settings
 66```
 67
 68**Scenario 3: Payment is declined**
 69```
 70Given I am logged in and attempt to place an order
 71When the payment gateway declines the transaction
 72Then the order is not created
 73  And I am shown a clear error message with next steps
 74  And my cart contents are preserved
 75```
 76
 77---
 78
 79## Example 2: Product Search
 80
 81**Title:** Search products by keyword with filters
 82
 83As a shopper,
 84I want to search for products by keyword and filter results by category and price,
 85So that I can quickly find items that match my needs.
 86
 87**Priority:** Must Have
 88**Story Points:** 8
 89**Sprint:** Sprint 2
 90
 91### Acceptance Criteria
 92
 93**Scenario 1: Keyword search returns relevant results**
 94```
 95Given I am on any page of the site
 96When I type "wireless headphones" into the search bar and press Enter
 97Then I see a results page showing products matching that keyword
 98  And results are sorted by relevance by default
 99  And the total number of results is displayed
100```
101
102**Scenario 2: Filter by price range**
103```
104Given I have search results displayed on screen
105When I set a price range of $20–$100 and apply the filter
106Then only products priced between $20 and $100 are shown
107  And the active filter is visually indicated
108  And I can remove the filter to restore full results
109```
110
111**Scenario 3: No results found**
112```
113Given I search for a term that matches no products
114When the search completes
115Then I see a "No results found" message
116  And I am shown suggested alternative search terms or popular categories
117```
118
119---
120
121## Example 3: Order Notifications
122
123**Title:** Receive real-time order status notifications
124
125As a customer who has placed an order,
126I want to receive notifications when my order status changes,
127So that I can track my delivery without manually checking the site.
128
129**Priority:** Should Have
130**Story Points:** 3
131**Sprint:** Sprint 4
132
133### Acceptance Criteria
134
135**Scenario 1: Notification sent when order ships**
136```
137Given my order status changes to "Shipped"
138When the fulfillment system updates the order record
139Then I receive an email notification within 5 minutes
140  And the email includes the tracking number and carrier name
141  And a tracking link is provided
142```
143
144**Scenario 2: User opts out of notifications**
145```
146Given I have opted out of marketing and order emails in my preferences
147When my order status changes
148Then I do not receive any email notifications
149  And I can still view order status by logging in to my account
150```
151
152---
153
154## INVEST Criteria Checklist
155
156Use this checklist to validate a user story before adding it to the sprint backlog.
157
158| Criterion   | Question to Ask                                        | Check |
159|-------------|--------------------------------------------------------|-------|
160| Independent | Can this story be developed without depending on another unfinished story? | [ ] |
161| Negotiable  | Is there room to discuss implementation details with the team? | [ ] |
162| Valuable    | Does this story deliver clear value to the user or business? | [ ] |
163| Estimable   | Does the team have enough information to estimate it?  | [ ] |
164| Small       | Can it be completed within a single sprint?            | [ ] |
165| Testable    | Are the acceptance criteria specific and verifiable?   | [ ] |
166
167---
168
169## Definition of Done (DoD)
170
171A story is considered complete when all of the following are true:
172
173- [ ] All acceptance criteria scenarios pass
174- [ ] Code is reviewed and merged to main branch
175- [ ] Unit and integration tests written and passing
176- [ ] No new linting or static analysis errors introduced
177- [ ] Feature tested in staging environment
178- [ ] Documentation or release notes updated if applicable
179- [ ] Product Owner has accepted the story