Agile – How to express what do do when error occurs in a user story

agilejiraproject-managementscrumuser-story

How do you express what to do when error occurs in a user story? Should the response to what happen on errors be in a task of the original user story, or should I create another user story that is concerned with what happens on errors?

E.g.

  1. This says nothing about what to do on errors such as credit card is invalid, not enough money, …

    As a buyer I want to pay for the order with a credit card to get immediately access to the services.

  2. I could add another user story like this:

    As a buyer I want to get information about errors during payment immediately so that I can fix the errors and try again.

Which of these is common/correct? Should the error handling be part of the original user story?

Best Answer

You'll get a lot a conflicting opinions on this one.

I typically like to specify happy-path behaviour and error behaviour in a single story unless that suddenly makes the story too large to work on. If error behaviour is complex then it should be its own story.

My favourite way of clearly specifying what is expected in a story (just happy-path, or error-path as well?) is by using Acceptance Criteria.

I don't consider a story to be implemented until all its Acceptance Criteria have been implemented.

In the case of your example, these could be:

Given I'm at the payment page,
When I pay with a Credit Card,
And the payment is accepted,
Then I expect access to the Services

Given I'm at the payment page,
When I pay with a Credit Card,
And the payment is declined
Then I expect a payment declined message