This post originated from an RSS feed registered with Agile Buzz
by Keith Ray.
Original Post: Story Card to FIT tests
Feed Title: MemoRanda
Feed URL: http://homepage.mac.com/1/homepage404ErrorPage.html
Feed Description: Keith Ray's notes to be remembered on agile software development, project management, oo programming, and other topics.
This is an partial example of how a story-card might be 'translated' into FIT tests -- this example is paraphrased from the middle chapters of "FIT for developing software" by Mugridge & Cunningham.
Here's a story card:
+--------------------------------------------------------+
| CreateRentalTemplate |
| |
| A rental template defines a list of rental items. The |
| template specifies the proportion of each item per |
| person. The user can select a template and specify the|
| number of people to rent those items. |
| |
+--------------------------------------------------------+
To accompany the story, there is discussion (verbal, spoken) between the programmers, testers, and the person that understands the requirements: the "Customer" in XP terminology, "Product Owner", "Domain Expert", etc. I'll leave out estimation and scheduling of stories, which are taken care of by Release Planning and Iteration Planning.
In the case of this story, there is discussion of how rounding-up will occur when the number of people specified doesn't exactly match the proportions in the Rental Template, so the test is written to use numbers that test the rounding-up.
Using FIT or Fitnesse, one acceptance test for CreateRentalTemplate would look something more or less like this:
--------------------------------------------------
| Create rental template | Coffee break |
--------------------------------------------------
| one | coffee dispenser | for | 20 | people |
--------------------------------------------------
| one | coffee table | for | 40 | people |
--------------------------------------------------
| one | cup | for | 0.9 | people |
--------------------------------------------------
--------------------------------------------------------
| begin transaction for client | Joanna |
--------------------------------------------------------
| fill template | Coffee break | for | 21 | people |
--------------------------------------------------------
| pay cash | 65.00 |
--------------------------------------------------------
| end transaction |
--------------------------------------------------------
| rentals of client | Joanna |
-------------------------------
| rental item | count |
-------------------------------
| coffee dispenser | 2 |
-------------------------------
| coffee table | 1 |
-------------------------------
| cup | 24 |
-------------------------------
The code to make this work would involve implementation various kinds of fixture classes, that will be instantiated by the FIT framework, and which in turn call the model objects to exercise the application. Initially the FIT tests will fail because the model objects do not exist or do not yet have required functionality. Use test-driven-development to create the model objects with the required behaviors. Then the FIT tests should pass.