In using stories, I find myself wanting to build scenarios on top of each other, For example I want something like Scenario: The user logs on Given a And b When c And d Then e And f Scenario: The user changes his password Given the user logs on And g Then h In other words, I''d like to write the second scenario starting with the ''state'' produced by the first. I''d like to ''invoke'' a scenario in a Given or When clause. I think that this should mean that the Given and When clauses of the scenario being invoked would be inserted/run at this point. The Then clauses wouldn''t I would think since these are ''tested'' when the original scenario is run. Does this make sense? How have others dealt with this? This is probably at tension with the XP notion of stories being minimal and isolated, but RBehave/RSpec stories already seem to have that tension IMHO. Thoughts? -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/
On Tue, Mar 11, 2008 at 12:14 PM, Rick DeNatale <rick.denatale at gmail.com> wrote:> In using stories, I find myself wanting to build scenarios on top of each other, > > For example > > I want something like > > Scenario: The user logs on > Given a > And b > When c > And d > Then e > And f > > Scenario: The user changes his password > Given the user logs on > And g > Then h > > In other words, I''d like to write the second scenario starting with > the ''state'' produced by the first. I''d like to ''invoke'' a scenario in > a Given or When clause. I think that this should mean that the Given > and When clauses of the scenario being invoked would be inserted/run > at this point. The Then clauses wouldn''t I would think since these > are ''tested'' when the original scenario is run. > > Does this make sense? How have others dealt with this? > > This is probably at tension with the XP notion of stories being > minimal and isolated, but RBehave/RSpec stories already seem to have > that tension IMHO.This is already supported - use GivenScenario like this: Scenario: The user changes his password GivenScenario: The user logs on And g Then h This only works within the same story. Cheers, David> > Thoughts? > > -- > Rick DeNatale > > My blog on Ruby > http://talklikeaduck.denhaven2.com/ > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
On 3/11/08, David Chelimsky <dchelimsky at gmail.com> wrote:> On Tue, Mar 11, 2008 at 12:14 PM, Rick DeNatale <rick.denatale at gmail.com> wrote: > > In using stories, I find myself wanting to build scenarios on top of each other, > > > > For example > > > > I want something like > > > > Scenario: The user logs on > > Given a > > And b > > When c > > And d > > Then e > > And f > > > > Scenario: The user changes his password > > Given the user logs on > > And g > > Then h > > > > In other words, I''d like to write the second scenario starting with > > the ''state'' produced by the first. I''d like to ''invoke'' a scenario in > > a Given or When clause. I think that this should mean that the Given > > and When clauses of the scenario being invoked would be inserted/run > > at this point. The Then clauses wouldn''t I would think since these > > are ''tested'' when the original scenario is run. > > > > Does this make sense? How have others dealt with this? > > > > This is probably at tension with the XP notion of stories being > > minimal and isolated, but RBehave/RSpec stories already seem to have > > that tension IMHO. > > > This is already supported - use GivenScenario like this: > > > Scenario: The user changes his password > > GivenScenario: The user logs on > And g > Then h > > This only works within the same story.Cool! -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/