[rspec-users] Plain Text Story example

Pat Maddox pergesu at gmail.com
Thu Nov 8 12:17:25 EST 2007


On Nov 8, 2007 8:01 AM, Glenn Ford <glenn at aldenta.com> wrote:
> I have in mind a scenario where a customer says "I tried to log in and
> it blew up!"  I take what they say with a business perspective and
> check my story and say "hey I've got a login story and it works" but
> that doesn't leave room for the fact that, slighty away from the norm
> of the usual login procedure, this particular user clicked another
> link in the middle of the process that changed some background
> variable, breaking the process at the final login step.  I would then
> want to write a story similar to the usual login, but with the ACTUAL
> details of what the customer did to ensure I could duplicate, fix, and
> then never have this problem creep up again.  My story, in order to be
> of use to me, would HAVE to have steps like "click this button"
> because, quite frankly, as a developer I find that's the sort of thing
> that can break my code and so I would want a story to account for it.
> A user following my intended user-flow, then deviating in a way I
> didn't predict.  From the business end, they still followed the login
> process, they just had one little different quirk along the way.

Hey Glenn,

Halted/canceled business processes are sometimes just as, or even
more, interesting than completed business processes.  So for example,
in your login story you could have a "canceled login" scenario.

Scenario user canceled the login process

Given the user goes to the login screen
And the user canceled login

When the user submits his credentials

Then ......


So now you have a story that captures what's going on in business
terms.  Maybe you don't want the behavior of them canceling it, and
perhaps you call it "suspends the login process" so that when he
finally submits his credentials the authentication goes as expected.

If you have a bunch of ways in which the user can suspend the login
process, you could create a separate "suspend login" story.  Put each
way the user can suspend the process in its own scenario.  Of course,
if you have many ways that the user can suspend logging in, your
authentication is probably too tightly coupled to the rest of your app
anyway.

Pat


More information about the rspec-users mailing list