I haven''t found any How To''s to use story runner and I''m not sure how to get started. Should I be looking for resources on how to use rbehave? How do I generate my first Story? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070920/07a80bc7/attachment.html
Andrew WC Brown wrote:> I haven''t found any How To''s to use story runner and I''m not sure how > to get started. > Should I be looking for resources on how to use rbehave? > How do I generate my first Story? > ------------------------------------------------------------------------ > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-usersPat wrote up an awesome tutorial/example: http://evang.eli.st/blog/2007/9/1/user-stories-with-rspec-s-story-runner That should get you started. -Ben
On 9/20/07, Ben Mabey <ben at benmabey.com> wrote:> Andrew WC Brown wrote: > > I haven''t found any How To''s to use story runner and I''m not sure how > > to get started. > > Should I be looking for resources on how to use rbehave? > > How do I generate my first Story? > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > Pat wrote up an awesome tutorial/example: > > http://evang.eli.st/blog/2007/9/1/user-stories-with-rspec-s-story-runner > > That should get you started. >This pastie may be of use as well: http://pastie.caboo.se/92472 James
I''m guessing their isn''t a generator for stories yet? ./script/generate story add_person On 9/20/07, James Hughes <hughes.james at gmail.com> wrote:> > On 9/20/07, Ben Mabey <ben at benmabey.com> wrote: > > Andrew WC Brown wrote: > > > I haven''t found any How To''s to use story runner and I''m not sure how > > > to get started. > > > Should I be looking for resources on how to use rbehave? > > > How do I generate my first Story? > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > rspec-users mailing list > > > rspec-users at rubyforge.org > > > http://rubyforge.org/mailman/listinfo/rspec-users > > Pat wrote up an awesome tutorial/example: > > > > http://evang.eli.st/blog/2007/9/1/user-stories-with-rspec-s-story-runner > > > > That should get you started. > > > > This pastie may be of use as well: > > http://pastie.caboo.se/92472 > > James > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070920/f2ed4363/attachment-0001.html
Looking in the trunk I couldn''t see any generators, for it. Looks like you found yourself a project ;) There is a simple new Story snippet in the textmate bundle in rspec''s trunk however. -Ben Andrew WC Brown wrote:> I''m guessing their isn''t a generator for stories yet? > > ./script/generate story add_person > > On 9/20/07, *James Hughes* < hughes.james at gmail.com > <mailto:hughes.james at gmail.com>> wrote: > > On 9/20/07, Ben Mabey < ben at benmabey.com > <mailto:ben at benmabey.com>> wrote: > > Andrew WC Brown wrote: > > > I haven''t found any How To''s to use story runner and I''m not > sure how > > > to get started. > > > Should I be looking for resources on how to use rbehave? > > > How do I generate my first Story? > > > > ------------------------------------------------------------------------ > > > > > > _______________________________________________ > > > rspec-users mailing list > > > rspec-users at rubyforge.org <mailto:rspec-users at rubyforge.org> > > > http://rubyforge.org/mailman/listinfo/rspec-users > > Pat wrote up an awesome tutorial/example: > > > > > http://evang.eli.st/blog/2007/9/1/user-stories-with-rspec-s-story-runner > > > > That should get you started. > > > > This pastie may be of use as well: > > http://pastie.caboo.se/92472 > > James > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org <mailto:rspec-users at rubyforge.org> > http://rubyforge.org/mailman/listinfo/rspec-users > > ------------------------------------------------------------------------ > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
On 20.9.2007, at 19.09, Ben Mabey wrote:> Looking in the trunk I couldn''t see any generators, for it. Looks > like > you found yourself a project ;) > There is a simple new Story snippet in the textmate bundle in rspec''s > trunk however.I just talked about this in Berlin with David. Heading out for dinner and beers now but I might take a stab at it tomorrow. -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi
I wouldn''t mind in on that On 9/20/07, Jarkko Laine <jarkko at jlaine.net> wrote:> > > On 20.9.2007, at 19.09, Ben Mabey wrote: > > > Looking in the trunk I couldn''t see any generators, for it. Looks > > like > > you found yourself a project ;) > > There is a simple new Story snippet in the textmate bundle in rspec''s > > trunk however. > > I just talked about this in Berlin with David. Heading out for dinner > and beers now but I might take a stab at it tomorrow. > > -- > Jarkko Laine > http://jlaine.net > http://dotherightthing.com > http://www.railsecommerce.com > http://odesign.fi > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-- Monsterbox Productions putting small businesses on-line 1319 Victoria Avenue East Thunder Bay, Ontario P7C 1C3 Canada Andrew WC Brown web-developer and owner andrew at monsterboxpro.com P: 807-626-9009 F: 807-624-2705 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070920/9a1c0a67/attachment.html
There are also a couple of examples buried in the trunk under examples/story/game-of-life/behaviour/stories On Sep 20, 2007, at 10:13 AM, Andrew WC Brown wrote:> I''m guessing their isn''t a generator for stories yet? > > ./script/generate story add_person > > On 9/20/07, James Hughes < hughes.james at gmail.com> wrote: > On 9/20/07, Ben Mabey < ben at benmabey.com> wrote: > > Andrew WC Brown wrote: > > > I haven''t found any How To''s to use story runner and I''m not > sure how > > > to get started. > > > Should I be looking for resources on how to use rbehave? > > > How do I generate my first Story? > > > > ---------------------------------------------------------------------- > -- > > > > > > _______________________________________________ > > > rspec-users mailing list > > > rspec-users at rubyforge.org > > > http://rubyforge.org/mailman/listinfo/rspec-users > > Pat wrote up an awesome tutorial/example: > > > > http://evang.eli.st/blog/2007/9/1/user-stories-with-rspec-s-story- > runner > > > > That should get you started. > > > > This pastie may be of use as well: > > http://pastie.caboo.se/92472 > > James > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070921/9869bc30/attachment-0001.html
I''m trying to generate stories based on Dan North''s example. I''m not sure how to do this. require File.join(File.dirname(__FILE__), "helper") Story "Account Holder withdraws cash", %{ As an Account Holder I want to withdraw cash from an ATM So that I can get money when the bank is closed }, :type => RailsStory do Scenario "Account has sufficient funds" do Given "the account balance is $", 100 do |amount| @account = Account.new(:balance => 100) end And "the card is valid" do @account.should_not have.error_on(:balance) end And "the machine contains enough money" do @account.sufficient_funds? end When "the Account Holder requests $", 20 do |amount| @account.withdraw(amount) end Then "the ATM should dispense $", 20 do |amount| post "/account/show", :account => {:amount => amount} #show the receipt end And "the account balance should be $", 80 do @account.balance.should be_eql(80) end And "the card should be returned" do post "account/index" end end Scenario "Account has insufficient funds" do; end Scenario "Card has been disabled" do; end Scenario "The ATM has insufficient funds" do; end end Scenario: Account has sufficient funds Given the account balance is $ 100 F Scenario: Account has insufficient funds . Scenario: Card has been disabled . Scenario: The ATM has insufficient funds . 4 scenarios: 3 succeeded, 1 failed, 0 pending FAILURES: 1) Account Holder withdraws cash (Account has sufficient funds) FAILED NameError: uninitialized constant Account /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:266:in `load_missing_constant'' When a failure occurs in a story does it always print out a heapstack or is my code incorrect? On 9/21/07, Evan David Light <evan at tiggerpalace.com> wrote:> > There are also a couple of examples buried in the trunk > under examples/story/game-of-life/behaviour/stories > On Sep 20, 2007, at 10:13 AM, Andrew WC Brown wrote: > > I''m guessing their isn''t a generator for stories yet? > > ./script/generate story add_person > > On 9/20/07, James Hughes < hughes.james at gmail.com> wrote: > > > > On 9/20/07, Ben Mabey < ben at benmabey.com> wrote: > > > Andrew WC Brown wrote: > > > > I haven''t found any How To''s to use story runner and I''m not sure > > how > > > > to get started. > > > > Should I be looking for resources on how to use rbehave? > > > > How do I generate my first Story? > > > > > > ------------------------------------------------------------------------ > > > > > > > > _______________________________________________ > > > > rspec-users mailing list > > > > rspec-users at rubyforge.org > > > > http://rubyforge.org/mailman/listinfo/rspec-users > > > Pat wrote up an awesome tutorial/example: > > > > > > > > http://evang.eli.st/blog/2007/9/1/user-stories-with-rspec-s-story-runner > > > > > > That should get you started. > > > > > > > This pastie may be of use as well: > > > > http://pastie.caboo.se/92472 > > > > James > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-- Monsterbox Productions putting small businesses on-line 1319 Victoria Avenue East Thunder Bay, Ontario P7C 1C3 Canada Andrew WC Brown web-developer and owner andrew at monsterboxpro.com P: 807-626-9009 F: 807-624-2705 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070921/1ecc340d/attachment-0001.html
On 9/21/07, Andrew WC Brown <omen.king at gmail.com> wrote:> I''m trying to generate stories based on Dan North''s example. > I''m not sure how to do this. > > require File.join(File.dirname(__FILE__), "helper") > > Story "Account Holder withdraws cash", %{ > As an Account Holder > I want to withdraw cash from an ATM > So that I can get money when the bank is closed > }, :type => RailsStory do > > Scenario "Account has sufficient funds" do > > Given "the account balance is $", 100 do |amount| > @account = Account.new(:balance => 100) > end > And "the card is valid" do > @account.should_not have.error_on(:balance) > end > And "the machine contains enough money" do > @account.sufficient_funds? > end > When "the Account Holder requests $", 20 do |amount| > @account.withdraw(amount) > end > Then "the ATM should dispense $", 20 do |amount| > post "/account/show", :account => {:amount => amount} #show the receipt > end > And "the account balance should be $", 80 do > @account.balance.should be_eql(80) > end > And "the card should be returned" do > post "account/index" > end > end > Scenario "Account has insufficient funds" do; end > Scenario "Card has been disabled" do; end > Scenario "The ATM has insufficient funds" do; end > > end > Scenario: Account has sufficient funds > > Given the account balance is $ 100 > F > Scenario: Account has insufficient funds > . > Scenario: Card has been disabled > . > Scenario: The ATM has insufficient funds > . > > > > 4 scenarios: 3 succeeded, 1 failed, 0 pending > > > FAILURES: > 1) Account Holder withdraws cash (Account has sufficient funds) FAILED > NameError: uninitialized constant Account > > /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:266:in > `load_missing_constant'' > > > When a failure occurs in a story does it always print out a heapstack or is > my code incorrect? >Your code looks correct. My interpretation of the workflow that derives from this tool is that you write a high level story like you have here, run it, and let it tell you what to do next. The stack trace is telling you that you need an Account class. So now you would drop down to the object level and write a spec for Account (this is a Rails Story, so you''d write a model spec). Once you have that passing, you might come back up to the story level and re-run it, at which point it might tell you that it doesn''t know about the balance() method on your account object; this would depend on how detailed you got in your model spec. I''m a total noob with this tool as well, so others on this list might have different insights; I''d be interested in hearing other perspectives on how detailed you''d get the first time you drill down to the object level: would you spec out the object completely as specified at the high level and then verify that it satisfies the story, or would you keep ping-ponging back and forth between the two levels? James> > On 9/21/07, Evan David Light <evan at tiggerpalace.com> wrote: > > > > There are also a couple of examples buried in the trunk under > examples/story/game-of-life/behaviour/stories > > > > > > > > > > On Sep 20, 2007, at 10:13 AM, Andrew WC Brown wrote: > > > > I''m guessing their isn''t a generator for stories yet? > > > > ./script/generate story add_person > > > > > > On 9/20/07, James Hughes < hughes.james at gmail.com> wrote: > > > On 9/20/07, Ben Mabey < ben at benmabey.com> wrote: > > > > Andrew WC Brown wrote: > > > > > I haven''t found any How To''s to use story runner and I''m not sure > how > > > > > to get started. > > > > > Should I be looking for resources on how to use rbehave? > > > > > How do I generate my first Story? > > > > > > ------------------------------------------------------------------------ > > > > > > > > > > _______________________________________________ > > > > > rspec-users mailing list > > > > > rspec-users at rubyforge.org > > > > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > Pat wrote up an awesome tutorial/example: > > > > > > > > > http://evang.eli.st/blog/2007/9/1/user-stories-with-rspec-s-story-runner > > > > > > > > That should get you started. > > > > > > > > > > This pastie may be of use as well: > > > > > > http://pastie.caboo.se/92472 > > > > > > James > > > _______________________________________________ > > > rspec-users mailing list > > > rspec-users at rubyforge.org > > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > > > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > > > -- > Monsterbox Productions > putting small businesses on-line > > 1319 Victoria Avenue East > Thunder Bay, Ontario P7C 1C3 > Canada > > Andrew WC Brown > web-developer and owner > andrew at monsterboxpro.com > P: 807-626-9009 > F: 807-624-2705 > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
Hi James. James Hughes wrote:> > Your code looks correct. > My interpretation of the workflow that derives from this tool is that > you write a high level story like you have here, run it, and let it > tell you what to do next. The stack trace is telling you that you need > an Account class. So now you would drop down to the object level and > write a spec for Account (this is a Rails Story, so you''d write a > model spec). Once you have that passing, you might come back up to the > story level and re-run it, at which point it might tell you that it > doesn''t know about the balance() method on your account object; this > would depend on how detailed you got in your model spec. > > I''m a total noob with this tool as well, so others on this list might > have different insights;For a total noob you''re right on the money! The reason there isn''t a story "generator" is that the story and scenarios should evolve as the output of a conversation between the tester/analyst and developer. You start with a (failing) scenario which identifies your "outermost" objects - in this case an Account. Then you drop into "traditional" TDD mode - or what we have started calling coding-by-example - to drive out the behaviour of the Account. Doing this you will probably discover other domain objects or services - say an AccountHolder or a BalanceTransferService - that you initially mock out to describe the behaviour of the Account. Then you implement the AccountHolder and BalanceTransferService in the same way, discovering other objects as you go, until you have concrete versions of each of the players in the scenario. Once these are all done, your scenario will work, and you''re ready to move onto the next scenario. This is what I mean by outside-in, which is different from both top-down (a module-wise breakdown of functionality) and bottom-up (start adding behaviour to objects and worry about tying them together later on). Right now, the story runner is less helpful than it could be (which is an ongoing conversation I''m having with David Chelimsky - short version, he''s right). The story runner /should/ visit every step in each scenario. When the first step fails, it should carry on to all the subsequent steps and at least tell you what they are even if it doesn''t execute them. That way you get the immediate feedback of failing fast, but you still see all the other steps in the scenario so you get a sense of context. Right now, it fails fast on the first failing step (which is correct) but it doesn''t then carry on to tell you about the subsequent steps (which is wrong).> I''d be interested in hearing other > perspectives on how detailed you''d get the first time you drill down > to the object level: would you spec out the object completely as > specified at the high level and then verify that it satisfies the > story, or would you keep ping-ponging back and forth between the two > levels? >You ping-pong at the granularity of a scenario. In other words, you get the scenario failing and then work inwards until you have all the moving parts to make the scenario work (and no more). Then you ping-pong up to the next scenario and work inwards again. It''s more like a pulse than a ping-pong. In reality, I find I run the scenarios quite often anyway to remind myself where I am and what the next unimplemented thing is.> James >Cheers, Dan>> On 9/21/07, Evan David Light <evan at tiggerpalace.com> wrote: >> >>> There are also a couple of examples buried in the trunk under >>> >> examples/story/game-of-life/behaviour/stories >> >>> >>> >>> On Sep 20, 2007, at 10:13 AM, Andrew WC Brown wrote: >>> >>> I''m guessing their isn''t a generator for stories yet? >>> >>> ./script/generate story add_person >>> >>> >>> On 9/20/07, James Hughes < hughes.james at gmail.com> wrote: >>> >>>> On 9/20/07, Ben Mabey < ben at benmabey.com> wrote: >>>> >>>>> Andrew WC Brown wrote: >>>>> >>>>>> I haven''t found any How To''s to use story runner and I''m not sure >>>>>> >> how >> >>>>>> to get started. >>>>>> Should I be looking for resources on how to use rbehave? >>>>>> How do I generate my first Story? >>>>>> >>>>>> >> ------------------------------------------------------------------------ >> >>>>>> _______________________________________________ >>>>>> rspec-users mailing list >>>>>> rspec-users at rubyforge.org >>>>>> http://rubyforge.org/mailman/listinfo/rspec-users >>>>>> >>>>> Pat wrote up an awesome tutorial/example: >>>>> >>>>> >>>>> >> http://evang.eli.st/blog/2007/9/1/user-stories-with-rspec-s-story-runner >> >>>>> That should get you started. >>>>> >>>>> >>>> This pastie may be of use as well: >>>> >>>> http://pastie.caboo.se/92472 >>>> >>>> James >>>> _______________________________________________ >>>> rspec-users mailing list >>>> rspec-users at rubyforge.org >>>> http://rubyforge.org/mailman/listinfo/rspec-users >>>> >>>> >>> _______________________________________________ >>> rspec-users mailing list >>> rspec-users at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/rspec-users >>> >>> _______________________________________________ >>> rspec-users mailing list >>> rspec-users at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/rspec-users >>> >>> >> >> -- >> Monsterbox Productions >> putting small businesses on-line >> >> 1319 Victoria Avenue East >> Thunder Bay, Ontario P7C 1C3 >> Canada >> >> Andrew WC Brown >> web-developer and owner >> andrew at monsterboxpro.com >> P: 807-626-9009 >> F: 807-624-2705 >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> >> > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070923/9fe42583/attachment.html