I’m trying to use stories to drive some high-level design.
I’ve got some branching scenarios where I want to follow a scenario,
to establish a base situation, and then have different scenarios which
‘branch’ out from that state, possibly several levels deep.
I asked a bit about this a few days ago, and David pointed out the
rather undocumented GivenScenario which seems to give the basic
ability to do what I’m after. So far it’s been working fairly well,
but I’ve run into a few quirks.
I’ve been working through my scenarios, and I’d commented out the
later ones to cut down on the ‘pending’ output while I develop the
steps. I’d get one scenario working and then go on to the next. So
at one point my plain text story looked something like this:
And I got Scenario A working and uncommented the next scenario, or so I
It took me a while to debug the resulting infinite loop. Perhaps
GivenScenario should check to see that it’s not asking for the CURRENT
- Having figured that out and moving on, I now have another
problem, which is what’s the best way to clean up the database so that
Scenario A can run again if it assumes that the stuff it put in the DB
isn’t there each time it runs. Cleaning the DB after running the
scenario won’t work since it defeats the purpose of using the scenario
as a pre-condition. Cleaning it before is more difficult,
particularly if I’m using parameterized steps. It would be nice if I
could somehow use database transactions, but I don’t see a nice way to
do that either.
Has anyone faced issues like these? Any ideas?
My blog on Ruby