Tim Harper
2009-Apr-01 22:51 UTC
[rspec-users] [cucumber] How to add a after failure hook?
Is currently a way to add a upon failure hook? I''d like to make it so that, in the event of a failed assertion, Webrat will take the last requested page and open it in a browser. Thanks :) Tim -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090401/414e6c57/attachment.html>
aslak hellesoy
2009-Apr-01 23:35 UTC
[rspec-users] [cucumber] How to add a after failure hook?
2009/4/2 Tim Harper <timcharper at gmail.com>> Is currently a way to add a upon failure hook? I''d like to make it so > that, in the event of a failed assertion, Webrat will take the last > requested page and open it in a browser. >http://wiki.github.com/aslakhellesoy/cucumber/hooks After do |scenario| # currently no simple way to query scenario for status though :-( end Please open a ticket for this if you really need it. Aslak> > Thanks :) > > Tim > > _______________________________________________ > 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/20090402/783e8205/attachment.html>
aidy lewis
2009-Apr-02 16:31 UTC
[rspec-users] [cucumber] How to add a after failure hook?
Hi Tim, I have used a custom formatter, if this is any help class ExceptionFormatter < Cucumber::Ast::Visitor def initialize(step_mother, io, options) super(step_mother) end def visit_feature_name(name) if name =~ /Feature:\s(.*)/i @name = $1 else @name = name end end def visit_exception(exception, status) exception_file = "#{File.dirname(__FILE__)}/#{@name}.html" open(exception_file, ''w'') { |f| f << browser.html } end end Aidy On 01/04/2009, Tim Harper <timcharper at gmail.com> wrote:> Is currently a way to add a upon failure hook? I''d like to make it so that, > in the event of a failed assertion, Webrat will take the last requested page > and open it in a browser. > > Thanks :) > > Tim > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
aslak hellesoy wrote:> > > 2009/4/2 Tim Harper <timcharper at gmail.com <mailto:timcharper at gmail.com>> > > Is currently a way to add a upon failure hook? I''d like to make > it so that, in the event of a failed assertion, Webrat will take > the last requested page and open it in a browser. > > > http://wiki.github.com/aslakhellesoy/cucumber/hooks > |After do |scenario| > # currently no simple way to query scenario for status though :-( > end > | > Please open a ticket for this if you really need it. > > AslakConvo has been moved to LH: https://rspec.lighthouseapp.com/projects/16211-cucumber/tickets/272-pick-up-failure-on-after-hook#ticket-272-2 -Ben> > > > Thanks :) > > Tim > > _______________________________________________ > 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
Tim Harper
2009-Apr-02 20:16 UTC
[rspec-users] [cucumber] How to add a after failure hook?
Aidy, This is a great work around, being disadvantaged only by having to specify a different formatter :) Still, a general purpose way of hooking in to the after feature fail would be premium. Thanks for opening the ticket. Tim On Thu, Apr 2, 2009 at 10:31 AM, aidy lewis <aidy.lewis at googlemail.com>wrote:> Hi Tim, > > I have used a custom formatter, if this is any help > > class ExceptionFormatter < Cucumber::Ast::Visitor > > def initialize(step_mother, io, options) > super(step_mother) > end > > def visit_feature_name(name) > if name =~ /Feature:\s(.*)/i > @name = $1 > else > @name = name > end > end > > def visit_exception(exception, status) > exception_file = "#{File.dirname(__FILE__)}/#{@name}.html" > open(exception_file, ''w'') { |f| f << browser.html } > end > end > > Aidy > > On 01/04/2009, Tim Harper <timcharper at gmail.com> wrote: > > Is currently a way to add a upon failure hook? I''d like to make it so > that, > > in the event of a failed assertion, Webrat will take the last requested > page > > and open it in a browser. > > > > Thanks :) > > > > Tim > > _______________________________________________ > > 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/20090402/9b583992/attachment.html>