[rspec-users] Any way to continue on Assertion Failure
matt at mattwynne.net
Wed May 27 04:07:51 EDT 2009
On 27 May 2009, at 03:38, Julian Leviston wrote:
> On 27/05/2009, at 9:33 AM, Gary Lin wrote:
>> 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?
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
it "should do foo and bar" do
Here's my normal RSpec flow:
it "should have done foo" do
it "should have done bar" do
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.
More information about the rspec-users