I have had a lot of hits from people searching for how to write user stories for project management solutions like Pivotal Tracker. User stories are used in the Agile development process so that the client can define the way that they want their application to perform. They are written in a way that a non computer savvy client can describe what they want to the developer.
User stories can be as simple as a one line sentence describing a function. This is normally to answer the “who”, “what”, and “where” but not necessarily always. A user story can also, and generally should, include a list of tasks that need to be accomplished to result in the desired behavior. User stories are a big portion of the Behavior Driven Development (BDD) as they describe a desired behavior.
A common term in writing user stories is ISBAT, short for “I should be able to” and is a great why for the client to think thru the functionality that they wish to achieve.
A simple user story example
The client wants a site that a customer can go to, create and account and purchase something. So the first thing we need to do is create an account. Our story could start as “As a user ISBAT create an account.” This reads and is clear to what the desired behavior is. So now how will we do that. We can create tasks working together with the client.
- Task 1 – visit the home page
- Task 2 – click on create an account
- Task 3 – fill in a form and submit it
- Task 4 – click on confirm my account in email
Now we have a pretty good understanding of exactly what the client wants and expects. The more explicit that the user stories are the easier it is to write your tests. You can use “create an account” in your describe and your first test should be it “creates new user account.” Following this story, you can easily write the rest of the test such as visit root_path, click_link “Create Account”, etc.