I woke up today at 3 a.m. and drove to Pittsburgh. I spent all day in client meetings. I then drove home to Baltimore. 20 hours today was dedicated to the endeavor. Still I make a small offering to the gods of my chain in the hopes that they will continue to look upon me with favor.
Even when my brain is not forming coherent thinkings, I still seem to be able to write Cucumber scenarios. It is possible that Cucumber exercises a different part of my brain, enabling me to write scenarios even under extreme circumstances. That, or Cucumber scenarios are dirt simple to write. Either way, one should draw the conclusion that there are no excuses for not writing Cucumber scenarios.
I add scenarios for two features in the legacy application that I have yet to capture in this new version: alternate recipes preparations view and archiving old recipes when updated, better recipes are create added.
The scenario for alternate preparations:
Feature: Alternate preparations for recipesThat is a relatively simple feature, requiring only two scenarios to describe it.
As a user curious about a recipe
I want to see a list of similar recipes
So that I can find a recipe that matches my tastes or ingredients on hand
Scenario: No alternate preparation
Given a "pancake" recipe with "buttermilk" in it
And no other recipes
When I view the recipe
Then I should see no alternate preparations
Scenario: Alternate preparation
Given a "Hearty Pancake" recipe with "wheat germ" in it
And a "Buttermilk Pancake" recipe with "buttermilk" in it
And a "Pancake" recipe with "chocolate chips" in it
When the three pancake recipes are alternate preparations of each other
And I visit the "Hearty Pancake" recipe
Then I should see a link to the "Buttermilk Pancake" recipe
And I should see a link to the "Pancake" recipe
And I should not see a link to the "Hearty Pancake" recipe
When I click the "Buttermilk Pancake" link
Then I should see a link to the "Hearty Pancake" recipe
And I should see a link to the "Pancake" recipe
And I should not see a link to the "Buttermilk Pancake" recipe
Similarly, the archiving feature:
Feature: Updating recipes in our cookbookAgain, this is a relatively simple feature. I do compact two different views of the feature (one from the outdated recipe, the other from the update) into one scenario. I might have created two different scenarios for each perspective, but I prefer the proximity of keeping everything in one scenario—it feels much closer to how an actual user would use the feature (clicking back and forth).
As an author
I want to mark recipes as replacing old one
So that I can record improvements and retain previous attempts for reference
Scenario: No previous or next version of a recipe
Given a "Buttermilk Pancake" recipe with "buttermilk" in it
When I view the recipe
Then I should not see previous versions of the recipe
And I should not see updated versions of the recipe
Scenario: A previous version of the recipe
Given a "Buttermilk Pancake" recipe with "buttermilk" in it
And a "Buttermilk Pancake" recipe on another day with "lowfat milk" in it
When the recipe with "buttermilk" is marked as update of the previous recipe
And I visit the recipe with "buttermilk" in it
Then I should see a link to the previous recipe with "lowfat milk" in it
And I should not see updated versions of the recipe
And I visit the recipe with "lowfat milk" in it
Then I should see a link to the updated recipe with "buttermilk" in it
And I should not see previous versions of the recipe
(commit)
Up next: sleep. Once sleep has done the trick, I will use my brain again to figure out what to work on next.
No comments:
Post a Comment