Evan David Light
2007-Sep-14 21:19 UTC
[rspec-users] Posted this in "dev" last night but I''m not sure that anyone reads it
I''ve been using RSpec in anger for perhaps a total of a few days and just started playing with Story Runner. Love it. I also started working on a patch, which ought to be simple, to allow for Scenarios without supplied blocks to be treated as pending -- much like "it" in Spec::DSL::ExampleAPI. That said, I noticed something that seemed odd and chatted with Rein Henrichs a little about it on #rspec. ScenarioRunner#run treats "pending" scenarios as an error case. We both believed this to be a little odd as we both thought that pending would just be a branch and not an error. That said, I thought that there may be a reasonable explanation. Evan Light IMs (all): sleight42 Twitter: elight http://evan.tiggerpalace.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070914/3aa25dc4/attachment.html
Pat Maddox
2007-Sep-14 23:10 UTC
[rspec-users] Posted this in "dev" last night but I''m not sure that anyone reads it
On 9/14/07, Evan David Light <evan at tiggerpalace.com> wrote:> > I''ve been using RSpec in anger for perhaps a total of a few days and just > started playing with Story Runner. Love it. > > I also started working on a patch, which ought to be simple, to allow for > Scenarios without supplied blocks to be treated as pending -- much like "it" > in Spec::DSL::ExampleAPI. > > That said, I noticed something that seemed odd and chatted with Rein > Henrichs a little about it on #rspec. ScenarioRunner#run treats "pending" > scenarios as an error case. We both believed this to be a little odd as we > both thought that pending would just be a branch and not an error. That > said, I thought that there may be a reasonable explanation. > > Evan Light > IMs (all): sleight42 > Twitter: elight > http://evan.tiggerpalace.com > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >Hrm...I added And "this should be pending" do pending "need something else" end to the end of one of my stories and got: And this should be pending P 4 scenarios: 3 succeeded, 0 failed, 1 pending I agree that it would be nice if story runner treats an empty Given/When/Then as pending. But what do you mean it treats pending as an error case? Pat
Evan David Light
2007-Sep-15 01:21 UTC
[rspec-users] Posted this in "dev" last night but I''m not sure that anyone reads it
On Sep 14, 2007, at 7:10 PM, Pat Maddox wrote:> I agree that it would be nice if story runner treats an empty > Given/When/Then as pending. But what do you mean it treats pending as > an error case?The actual implementation of how a Scenario is defined as pending. The implementation raises a particular type of Error (name eludes me as I''m not steeped in code at the moment, sorry) which the ScenarioRunner rescues and, based on that, then processes the Scenario as pending. Typically, this would simply be a conditional branch in the code and, frankly, seems like an abuse of error handling. Incidentally, I submitted the patch last night to allow Scenarios without blocks to default to pending. Hopefully, Dan (North) likes it. It makes sense that the expectation metaphors through RSpec (and now Story Runner) would behave consistently. This just makes Scenario behave like "it". I have yet to look closely at the implementations of Given/Then/When/ And (forgot about that one, thanks!). Maybe if I get some time this weekend. Unfortunately, I''m spending the rest of tonight and most of tomorrow doing some work for the office... The deeper I get into it, the more that I love this tool.... Evan
Evan David Light
2007-Sep-15 03:06 UTC
[rspec-users] Posted this in "dev" last night but I''m not sure that anyone reads it
On Sep 14, 2007, at 7:10 PM, Pat Maddox wrote:> I agree that it would be nice if story runner treats an empty > Given/When/Then as pending. But what do you mean it treats pending as > an error case? >Resending. Believe that my re-reponse, sent a couple of hours ago, was eaten. ;-) The actual implementation of how a Scenario is defined as pending. The implementation raises a particular type of Error (name eludes me as I''m not steeped in code at the moment, sorry) which the ScenarioRunner rescues and, based on that, then processes the Scenario as pending. Typically, this would simply be a conditional branch in the code and, frankly, seems like an abuse of error handling. Incidentally, I submitted the patch last night to allow Scenarios without blocks to default to pending. Hopefully, Dan (North) likes it. It makes sense that the expectation metaphors through RSpec (and now Story Runner) would behave consistently. This just makes Scenario behave like "it". I have yet to look closely at the implementations of Given/Then/When/ And (forgot about that one, thanks!). Maybe if I get some time this weekend. Unfortunately, I''m spending the rest of tonight and most of tomorrow doing some work for the office... The deeper I get into it, the more that I love this tool.... Evan
Jonathan Linowes
2007-Oct-01 17:45 UTC
[rspec-users] Posted this in "dev" last night but I''m not sure that anyone reads it
If you add the pending statement before other non-pending ones, it stops at the first pending one. That forces me to implement them in the order specified, a rough example: Then "user was authorized to perform this action" And "action was completed correctly" do ... end On Sep 14, 2007, at 7:10 PM, Pat Maddox wrote:> On 9/14/07, Evan David Light <evan at tiggerpalace.com> wrote: >> >> I''ve been using RSpec in anger for perhaps a total of a few days >> and just >> started playing with Story Runner. Love it. >> >> I also started working on a patch, which ought to be simple, to >> allow for >> Scenarios without supplied blocks to be treated as pending -- much >> like "it" >> in Spec::DSL::ExampleAPI. >> >> That said, I noticed something that seemed odd and chatted with Rein >> Henrichs a little about it on #rspec. ScenarioRunner#run treats >> "pending" >> scenarios as an error case. We both believed this to be a little >> odd as we >> both thought that pending would just be a branch and not an >> error. That >> said, I thought that there may be a reasonable explanation. >> >> Evan Light >> IMs (all): sleight42 >> Twitter: elight >> http://evan.tiggerpalace.com >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> > > Hrm...I added > > And "this should be pending" do > pending "need something else" > end > > to the end of one of my stories and got: > > And this should be pending > P > 4 scenarios: 3 succeeded, 0 failed, 1 pending > > I agree that it would be nice if story runner treats an empty > Given/When/Then as pending. But what do you mean it treats pending as > an error case? > > Pat > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
Dan North
2007-Oct-01 21:10 UTC
[rspec-users] Posted this in "dev" last night but I''m not sure that anyone reads it
Hi Jonathan. The pending method uses an exception to fail fast out of the step, but the runner knows it''s a special case so it treats it accordingly. That''s why pending steps or scenarios are reported differently from failures in the runner. It would be easy to reimplement pending using Ruby''s throw/catch mechanism which is separate from the exception mechanism, I just didn''t think to do it at the time. (Plus, the rspec example runner uses exceptions too so it makes sense for the story runner to do the same.) As for the first pending (or failing) step terminating the scenario, this is a tricky one. You don''t want the scenario to carry on executing because something has already gone wrong (either by failing or simply by not being implemented yet), but there are listeners that want to know what other steps would have run, for documentation for example. I am thinking of something like this: once a step fails, iterate over the remaining steps in the scenario, passing them into the found_step method on any documenters, but not actually executing the steps. This would strike a balance between actually executing the steps - which wouldn''t make sense - and simply ignoring them, which makes the documentation look weird. Maybe they could be coloured differently in the (as-yet-unwritten) html story documenter, so you would have a bunch of green steps, one red or yellow step (the failing or pending one), and the remaining unexecuted ones in grey. On 10/1/07, Jonathan Linowes <jonathan at parkerhill.com> wrote:> > If you add the pending statement before other non-pending ones, it > stops at the first pending one. That forces me to implement them in > the order specified, a rough example: > > Then "user was authorized to perform this action" > > And "action was completed correctly" do > ... > end > > > > On Sep 14, 2007, at 7:10 PM, Pat Maddox wrote: > > > On 9/14/07, Evan David Light <evan at tiggerpalace.com> wrote: > >> > >> I''ve been using RSpec in anger for perhaps a total of a few days > >> and just > >> started playing with Story Runner. Love it. > >> > >> I also started working on a patch, which ought to be simple, to > >> allow for > >> Scenarios without supplied blocks to be treated as pending -- much > >> like "it" > >> in Spec::DSL::ExampleAPI. > >> > >> That said, I noticed something that seemed odd and chatted with Rein > >> Henrichs a little about it on #rspec. ScenarioRunner#run treats > >> "pending" > >> scenarios as an error case. We both believed this to be a little > >> odd as we > >> both thought that pending would just be a branch and not an > >> error. That > >> said, I thought that there may be a reasonable explanation. > >> > >> Evan Light > >> IMs (all): sleight42 > >> Twitter: elight > >> http://evan.tiggerpalace.com > >> _______________________________________________ > >> rspec-users mailing list > >> rspec-users at rubyforge.org > >> http://rubyforge.org/mailman/listinfo/rspec-users > >> > > > > Hrm...I added > > > > And "this should be pending" do > > pending "need something else" > > end > > > > to the end of one of my stories and got: > > > > And this should be pending > > P > > 4 scenarios: 3 succeeded, 0 failed, 1 pending > > > > I agree that it would be nice if story runner treats an empty > > Given/When/Then as pending. But what do you mean it treats pending as > > an error case? > > > > Pat > > _______________________________________________ > > 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/20071001/1612a248/attachment.html
Jonathan Linowes
2007-Oct-02 02:44 UTC
[rspec-users] skip pending (was Re: Posted this in "dev" last night but I''m not sure that anyone reads it)
The way I''ve started using story runner is to write the story and scenarios, and then implement each step incrementally. The order that I implement is not necessarily the order its logically written. Lets say I want to get the story working without the authentication, so a Given clause and a Then clause might be pending; but I''d still want the story to run though the rest of the stuff. I tried calling pending ("TO DO") in the do end block,but that gave same result. Well, what if we added a new method, like skip_this_because("authentication not implemented yet") ?? :) On Oct 1, 2007, at 5:10 PM, Dan North wrote:> Hi Jonathan. > > The pending method uses an exception to fail fast out of the step, > but the runner knows it''s a special case so it treats it > accordingly. That''s why pending steps or scenarios are reported > differently from failures in the runner. It would be easy to > reimplement pending using Ruby''s throw/catch mechanism which is > separate from the exception mechanism, I just didn''t think to do it > at the time. (Plus, the rspec example runner uses exceptions too so > it makes sense for the story runner to do the same.) > > As for the first pending (or failing) step terminating the > scenario, this is a tricky one. You don''t want the scenario to > carry on executing because something has already gone wrong (either > by failing or simply by not being implemented yet), but there are > listeners that want to know what other steps would have run, for > documentation for example. > > I am thinking of something like this: once a step fails, iterate > over the remaining steps in the scenario, passing them into the > found_step method on any documenters, but not actually executing > the steps. This would strike a balance between actually executing > the steps - which wouldn''t make sense - and simply ignoring them, > which makes the documentation look weird. > > Maybe they could be coloured differently in the (as-yet-unwritten) > html story documenter, so you would have a bunch of green steps, > one red or yellow step (the failing or pending one), and the > remaining unexecuted ones in grey. > > > On 10/1/07, Jonathan Linowes <jonathan at parkerhill.com> wrote: > If you add the pending statement before other non-pending ones, it > stops at the first pending one. That forces me to implement them in > the order specified, a rough example: > > Then "user was authorized to perform this action" > > And "action was completed correctly" do > ... > end > > > > On Sep 14, 2007, at 7:10 PM, Pat Maddox wrote: > > > On 9/14/07, Evan David Light < evan at tiggerpalace.com> wrote: > >> > >> I''ve been using RSpec in anger for perhaps a total of a few days > >> and just > >> started playing with Story Runner. Love it. > >> > >> I also started working on a patch, which ought to be simple, to > >> allow for > >> Scenarios without supplied blocks to be treated as pending -- much > >> like "it" > >> in Spec::DSL::ExampleAPI. > >> > >> That said, I noticed something that seemed odd and chatted with > Rein > >> Henrichs a little about it on #rspec. ScenarioRunner#run treats > >> "pending" > >> scenarios as an error case. We both believed this to be a little > >> odd as we > >> both thought that pending would just be a branch and not an > >> error. That > >> said, I thought that there may be a reasonable explanation. > >> > >> Evan Light > >> IMs (all): sleight42 > >> Twitter: elight > >> http://evan.tiggerpalace.com > >> _______________________________________________ > >> rspec-users mailing list > >> rspec-users at rubyforge.org > >> http://rubyforge.org/mailman/listinfo/rspec-users > >> > > > > Hrm...I added > > > > And "this should be pending" do > > pending "need something else" > > end > > > > to the end of one of my stories and got: > > > > And this should be pending > > P > > 4 scenarios: 3 succeeded, 0 failed, 1 pending > > > > I agree that it would be nice if story runner treats an empty > > Given/When/Then as pending. But what do you mean it treats > pending as > > an error case? > > > > Pat > > _______________________________________________ > > 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-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20071001/b9a57f27/attachment.html
fyi, In the meantime I''ve written a little helper def skip_pending(text='''') puts "SKIP PENDING #{text}" end so I can do And "foo foo bar bar" do skip_pending "Implement foo bar" end On Oct 1, 2007, at 10:44 PM, Jonathan Linowes wrote:> The way I''ve started using story runner is to write the story and > scenarios, and then implement each step incrementally. The order > that I implement is not necessarily the order its logically > written. Lets say I want to get the story working without the > authentication, so a Given clause and a Then clause might be > pending; but I''d still want the story to run though the rest of the > stuff. I tried calling pending("TO DO") in the do end block,but > that gave same result. Well, what if we added a new method, like > skip_this_because("authentication not implemented yet") ?? :) > > > On Oct 1, 2007, at 5:10 PM, Dan North wrote: > >> Hi Jonathan. >> >> The pending method uses an exception to fail fast out of the step, >> but the runner knows it''s a special case so it treats it >> accordingly. That''s why pending steps or scenarios are reported >> differently from failures in the runner. It would be easy to >> reimplement pending using Ruby''s throw/catch mechanism which is >> separate from the exception mechanism, I just didn''t think to do >> it at the time. (Plus, the rspec example runner uses exceptions >> too so it makes sense for the story runner to do the same.) >> >> As for the first pending (or failing) step terminating the >> scenario, this is a tricky one. You don''t want the scenario to >> carry on executing because something has already gone wrong >> (either by failing or simply by not being implemented yet), but >> there are listeners that want to know what other steps would have >> run, for documentation for example. >> >> I am thinking of something like this: once a step fails, iterate >> over the remaining steps in the scenario, passing them into the >> found_step method on any documenters, but not actually executing >> the steps. This would strike a balance between actually executing >> the steps - which wouldn''t make sense - and simply ignoring them, >> which makes the documentation look weird. >> >> Maybe they could be coloured differently in the (as-yet-unwritten) >> html story documenter, so you would have a bunch of green steps, >> one red or yellow step (the failing or pending one), and the >> remaining unexecuted ones in grey. >> >> >> On 10/1/07, Jonathan Linowes <jonathan at parkerhill.com> wrote: >> If you add the pending statement before other non-pending ones, it >> stops at the first pending one. That forces me to implement them in >> the order specified, a rough example: >> >> Then "user was authorized to perform this action" >> >> And "action was completed correctly" do >> ... >> end >> >> >> >> On Sep 14, 2007, at 7:10 PM, Pat Maddox wrote: >> >> > On 9/14/07, Evan David Light < evan at tiggerpalace.com> wrote: >> >> >> >> I''ve been using RSpec in anger for perhaps a total of a few days >> >> and just >> >> started playing with Story Runner. Love it. >> >> >> >> I also started working on a patch, which ought to be simple, to >> >> allow for >> >> Scenarios without supplied blocks to be treated as pending -- much >> >> like "it" >> >> in Spec::DSL::ExampleAPI. >> >> >> >> That said, I noticed something that seemed odd and chatted >> with Rein >> >> Henrichs a little about it on #rspec. ScenarioRunner#run treats >> >> "pending" >> >> scenarios as an error case. We both believed this to be a little >> >> odd as we >> >> both thought that pending would just be a branch and not an >> >> error. That >> >> said, I thought that there may be a reasonable explanation. >> >> >> >> Evan Light >> >> IMs (all): sleight42 >> >> Twitter: elight >> >> http://evan.tiggerpalace.com >> >> _______________________________________________ >> >> rspec-users mailing list >> >> rspec-users at rubyforge.org >> >> http://rubyforge.org/mailman/listinfo/rspec-users >> >> >> > >> > Hrm...I added >> > >> > And "this should be pending" do >> > pending "need something else" >> > end >> > >> > to the end of one of my stories and got: >> > >> > And this should be pending >> > P >> > 4 scenarios: 3 succeeded, 0 failed, 1 pending >> > >> > I agree that it would be nice if story runner treats an empty >> > Given/When/Then as pending. But what do you mean it treats >> pending as >> > an error case? >> > >> > Pat >> > _______________________________________________ >> > 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 > > _______________________________________________ > 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/20071008/8180836c/attachment.html