Wednesday, May 27, 2009

Inventory Before Moving On

‹prev | My Chain | next›

First up tonight, I follow the advice of an astute reader and probe a date boundary in a little more depth. In my browse-meals-by-month Cucumber scenario, I had only probed navigation between months, but failed to perform similar navigation across a year boundary.

To address this, I add a meal from 2003 to the scenario (in bold):
  Scenario: Browsing a meal in a given month

Given a "Even Fried, They Won't Eat It" meal enjoyed in May 2009
And a "Salad. Mmmm." meal enjoyed in April 2009
And a "Almost French Onion Soup" meal enjoyed in September 2003
When I view the list of meals prepared in May of 2009
Then I should see the "Even Fried, They Won't Eat It" meal among the meals of this month
And I should not see the "Salad. Mmmm." meal among the meals of this month
And I should not see a link to June 2009
When I follow the link to the list of meals in April 2009
Then I should not see the "Even Fried, They Won't Eat It" meal among the meals of this month
And I should see the "Salad. Mmmm." meal among the meals of this month
And I should see a link to May 2009
And I should not see a link to February 2009
When I follow the link to the list of meals in September 2003
Then I should see the "Almost French Onion Soup" meal among the meals of this month
And I should see a link to April 2009
Running the scenario now, everything is passing:



Nice! I didn't need to add any code, but now have assurance that it will work, even across year boundaries.

With that, I am considering that scenario complete.
(commit)

Before moving onto the next scenario, I run all of the Cucumber scenarios to ensure that I haven't accidentally broken something and to see where I'm at. Where I am at is:



135 passed steps and only 4 step undefined am I really that close to being done? Sadly no.

I need to do a quick inventory of what is left before I am done:
  • The home page

  • CSS—everything is unstyled at this point

  • Deploy CouchDB design documents

  • Advanced search interface

  • RSS Feeds

  • Mailing lists

  • Feedback forms

  • Cookbook collection—a list of the cookbooks (linked to via our Amazon associates account) from which various recipes draw inspiration

Since I am replacing an existing site, I probably cannot get away with omitting many of those. I ought to be able to deploy without the advanced search form, the cookbook collection, and the mailing lists, at least initially. But I will definitely need a home page and CSS. I probably should not orphan the RSS feed either.

That means more Cucumber scenarios. First up, RSS feeds...

I like to anthropomorphize all non-human actors. It helps me to conceptualize what really needs to be done. Nothing too fancy in the case of RSS consumers:
 Feature: RSS

So that I tell my user when there are updates to this great cooking site
As an RSS bot
I want to be able to consume your RSS

Scenario: Meal RSS

Given 20 yummy meals
When I access the meal RSS feed
Then I should see the 10 most recent meals
And I should see the summary of each meal

Scenario: Recipe RSS

Given 20 delicious, easy to prepare recipes
When I access the recipe RSS feed
Then I should see the 10 most recent recipes
And I should see the summary of each recipe
Additionally, I add a general site-wide feature description with 5 scenarios (individual step text not included for brevity's sake):
Feature: Site

So that I may explore many wonderful recipes and see the meals in which they were served
As someone interested in cooking
I want to be able to easily explore this awesome site

Scenario: Quickly scanning meals and recipes accessible from the home page

Scenario: Exploring food categories (e.g. Italian) from the homepage

Scenario: Give feedback to the authors of this fantastic site

Scenario: Give feedback to the authors on a yummy meal

Scenario: Give feedback to the authors on a delicious recipe

(commit)

With that, I am up to 54 undefined Cucumber steps. That's somewhat deflating, but should serve as a fairly realistic estimate of the outstanding work remaining before I can deploy.

And I'll get started with the first of those 54 steps tomorrow.

4 comments:

  1. Am i an astute reader?! I feel honoured to have been given that title!

    I love 'reassurance' steps that work without any extra code necessary. They are my favourite kind! :) You're usually fairly confident that they will work, but it's nice to write them just to be sure.

    Keep up the good work! How many steps do you have in total now?

    ReplyDelete
  2. Aimee, Indeed you are said astute reader -- your feedback is much appreciated!

    Those reassurance steps are great. I "knew" that boundary condition would work. If I knew it, why not prove it? Thanks for the push :)

    I'm adding some more steps today (tomorrow for you). I'll be around 215 steps (~70 undefined) for 28 scenarios when my next post is ready to go.

    ReplyDelete
  3. Very nice. Do you fancy co-authoring a book with me? I think this series would make an excellent introduction to both behaviour-driven development and CouchDB. Let me know if you're interested.

    ReplyDelete
  4. Wow. I'm flattered you think there is something in here that might be sculpted into book format. I would think a straight read of this series would get tedious after a while.

    I'm not sure where I'd eke out more time from my day to give appropriate attention to a book, but I'd be very interested in hearing your thoughts :)

    Drop me a line at chris.eee @ gmail and I'd be happy to chat about the idea.

    ReplyDelete