On 27 May 2009, at 03:38, Julian Leviston wrote:

On 27/05/2009, at 9:33 AM, Gary Lin wrote:

Hi,

I wonder if there is any way to tell the test script to continue even when encountering an assertion failure? The reason I am asking this is because I have a test flow that can take a long time to run and it would be very useful if I can perform all verification at the end of test flow in one shot rather than fail one and exit immediately. Of course, I could break each verification point into separate test case, but then it will double or triple the overall execution time. Does RSpec support this?


Isn't this usual behaviour?

Julian.

Yeah I'm a little confused by the question (and David's response) so maybe I've misunderstood something. Normal RSpec test runs will catch all the test failures and report them at the end of the run. I wonder whether the OP is talking about a situation where the interaction with the system takes a long time, so that using lots of examples of the desired behaviour causes that interaction to be run several times making the whole run very slow.

I also wonder whether he's just thinking in the test/unit mindset, which I see a lot, where you have examples like this

<antipattern>
it "should do foo and bar" do
  set_up_state
  do_something_to_system_under_test

  assert_that_foo_was_done
  assert_that_bar_was_done
end
</antipattern>

Here's my normal RSpec flow:

before(:each) do
  set_up_state
  do_something_to_system_under_test
end

it "should have done foo" do
  assert_that_foo_was_done
end

it "should have done bar" do
  assert_that_bar_was_done
end

if set_up_state and/or do_something_to_system_under_test take ages, you could use a before(:all) block instead, but that comes with obvious leaky state disadvantages.

Matt Wynne
http://beta.songkick.com
http://blog.mattwynne.net



_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to