Magnus Erickson
2011-Mar-09 12:00 UTC
[rspec-users] Are there any ways to detect spec faults during a run?
Hi, Is there a way to detect if an example has failed? Something like a: "example_failed?" method. In my case I need to dump some information, i.e trace and error log, to be used when analyzing what went wrong in the example. I''m thinking about putting it in a after(:each) {}. BR Magnus -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110309/cbb2e743/attachment-0001.html>
Magnus Erickson
2011-Mar-09 12:30 UTC
[rspec-users] Are there any ways to detect spec faults during a run?
Hi, Is there a way to detect if an example has failed? Something like a: "example_failed?" method. In my case I need to dump some information, i.e trace and error log, to be used when analyzing what went wrong in the example. I''m thinking about putting it in a after(:each) {}. BR Magnus -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110309/d933bd62/attachment.html>
Magnus Erickson
2011-Mar-09 12:32 UTC
[rspec-users] Are there any ways to detect spec faults during a run?
Hi, Is there a way to detect if an example has failed? Something like a: "example_failed?" method. In my case I need to dump some information, i.e trace and error log, to be used when analyzing what went wrong in the example. I''m thinking about putting it in a after(:each) {}. BR Magnus -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110309/73144cd2/attachment.html>
David Chelimsky
2011-Mar-13 13:58 UTC
[rspec-users] Are there any ways to detect spec faults during a run?
On Mar 9, 2011, at 6:00 AM, Magnus Erickson wrote:> Hi, > Is there a way to detect if an example has failed? Something like a: "example_failed?" method. > In my case I need to dump some information, i.e trace and error log, to be used when analyzing what > went wrong in the example. I''m thinking about putting it in a after(:each) {}.after(:each) won''t work because failures aren''t actually reported out until all of the after hooks are processed. Your best bet is a custom formatter. See: http://relishapp.com/rspec/rspec-core/v/2-5/dir/formatters/custom-formatters http://relishapp.com/rspec/rspec-core/v/2-5/dir/command-line/format-option HTH, David
Magnus Erickson
2011-Mar-15 10:25 UTC
[rspec-users] Are there any ways to detect spec faults during a run?
Thanks for the answer David! It can be done via a custom formatter but then flexibility will be lost as well as visibility. It would really be handy to have this feature. Is there any other way of doing it? Is it possible to patch into RSpec in any way? What about after(:each).failure as a new feature in RSpec? BR Magnus 2011/3/13 David Chelimsky <dchelimsky at gmail.com>> On Mar 9, 2011, at 6:00 AM, Magnus Erickson wrote: > > > Hi, > > Is there a way to detect if an example has failed? Something like a: > "example_failed?" method. > > In my case I need to dump some information, i.e trace and error log, to > be used when analyzing what > > went wrong in the example. I''m thinking about putting it in a > after(:each) {}. > > after(:each) won''t work because failures aren''t actually reported out until > all of the after hooks are processed. > > Your best bet is a custom formatter. See: > > > http://relishapp.com/rspec/rspec-core/v/2-5/dir/formatters/custom-formatters > http://relishapp.com/rspec/rspec-core/v/2-5/dir/command-line/format-option > > HTH, > David > > > _______________________________________________ > 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/20110315/f6de10f6/attachment.html>
David Chelimsky
2011-Mar-15 11:32 UTC
[rspec-users] Are there any ways to detect spec faults during a run?
On Mar 15, 2011, at 5:25 AM, Magnus Erickson wrote:> > 2011/3/13 David Chelimsky <dchelimsky at gmail.com> > On Mar 9, 2011, at 6:00 AM, Magnus Erickson wrote: > > > Hi, > > Is there a way to detect if an example has failed? Something like a: "example_failed?" method. > > In my case I need to dump some information, i.e trace and error log, to be used when analyzing what > > went wrong in the example. I''m thinking about putting it in a after(:each) {}. > > after(:each) won''t work because failures aren''t actually reported out until all of the after hooks are processed. > > Your best bet is a custom formatter. See: > > http://relishapp.com/rspec/rspec-core/v/2-5/dir/formatters/custom-formatters > http://relishapp.com/rspec/rspec-core/v/2-5/dir/command-line/format-option > > HTH, > David >> Thanks for the answer David! > > It can be done via a custom formatter but then flexibility will be lost as well as visibility. > It would really be handy to have this feature. Is there any other way of doing it? Is it possible to > patch into RSpec in any way? What about after(:each).failure as a new feature in RSpec? > > BR > MagnusWhat do you mean by "flexibility will be lost"? Also, please bottom-post (or inline-post) instead of top-posting [1], especially if that has already been established for the conversation. Cheers, David [1] http://idallen.com/topposting.html -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110315/47e88aea/attachment.html>
Magnus Erickson
2011-Mar-18 15:00 UTC
[rspec-users] Are there any ways to detect spec faults during a run?
2011/3/15 David Chelimsky <dchelimsky at gmail.com>> On Mar 15, 2011, at 5:25 AM, Magnus Erickson wrote: > > > 2011/3/13 David Chelimsky <dchelimsky at gmail.com> > >> On Mar 9, 2011, at 6:00 AM, Magnus Erickson wrote: >> >> > Hi, >> > Is there a way to detect if an example has failed? Something like a: >> "example_failed?" method. >> > In my case I need to dump some information, i.e trace and error log, to >> be used when analyzing what >> > went wrong in the example. I''m thinking about putting it in a >> after(:each) {}. >> >> after(:each) won''t work because failures aren''t actually reported out >> until all of the after hooks are processed. >> >> Your best bet is a custom formatter. See: >> >> >> http://relishapp.com/rspec/rspec-core/v/2-5/dir/formatters/custom-formatters >> http://relishapp.com/rspec/rspec-core/v/2-5/dir/command-line/format-option >> >> HTH, >> David >> >> > Thanks for the answer David! > > It can be done via a custom formatter but then flexibility will be lost as > well as visibility. > It would really be handy to have this feature. Is there any other way of > doing it? Is it possible to > patch into RSpec in any way? What about after(:each).failure as a new > feature in RSpec? > > BR > Magnus > > > > What do you mean by "flexibility will be lost"? > > > Also, please bottom-post (or inline-post) instead of top-posting [1], > especially if that has already been established for the conversation. > > > Cheers, > > David > >Hi! If having the option to ask if a fault has occurred in a scenario, the measure to be taken upon detection is visible ie. in the spec file and the action can be tailored depending on whats on test. That''s what I mean with flexibility. Cheers Magnus> > _______________________________________________ > 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/20110318/3b6c9bae/attachment.html>