May 10, 2009

Writing the Reader's Stories for the First BDD Blog Release

I continue with my plan to write user stories for my first release. In this post I'll cover features from the readers perspective.

  1. Must be able to Create, Edit and View posts.
  2. Must support per post permanent URLs
Here's the first draft of the readers browsing feature. We'll see where it evolves to in the future.

Feature: browsing
As a reader
I want to browse the site
So that I can read it's content


#
# scenarios that involve the reader navigating to the
# home page as the number of available posts vary
#
Scenario: 0 of 0
Given that 0 posts exist
When I go to the home page
Then I should be on the error page
And I should see "page not found"

Scenario: 1 of 1
Given that 1 post exists
When I go to the home page
Then I should be on post page 1
And I should not see a link to the next post
And I should not see a link to the previous post

Scenario: 2 of 2
Given that 2 posts exist
When I go to the home page
Then I should be on post page 2
And I should see a link to the previous post
And I should not see a link to the next post


#
# Scenarios that involve the reader navigating to a specific
# post; the first, middle and last. These primarily demonstrate
# the behavior of the navigation links to previous and next
# post pages
#
Scenario: 1 of 2
Given that 2 posts exist
When I go to post page 1
Then I should not see a link to the previous post
And I should see a lnk to the next post

Scenario: 2 of 3
Given that 3 posts exist
When I go to post page 2
Then I should see a link to the previous post
And I should see a link to the next post


#
# navigation to specific posts is done through post
# page permalinks. The permalinks are derived from
# the title of the post
#
Scenario: navigate to an non-existant post
Given that no posts have been created
When I go to the path /posts/get-rich-overnight
Then I should be on the error page
And I should see "page not found"
And I should see a link to the home page

Scenario: navigate to an existing post
Given that post 1 exists
And that post 1 has the title "Get Rich Overnight"
And that post 1 has the body lorem ispum
When I go to /posts/get-rich-overnight
Then I should see "Get Rich Overnight"
And I should see lorem ipsum

No comments: