[rspec-users] Cucumber seems to be running steps after failed steps ...

Korny Sietsma korny at sietsma.com
Fri Mar 13 03:05:25 EDT 2009


Hmm - it might be because I had both cucumber-0.1.16 and the
aslakhellesoy-cucumber gem installed - I'll try to get rid of the old
cucumber gem and see if that helps.  (Though my initial attempts are causing
all sorts of pain with things that seem to require 'cucumber' not
'aslakhellesoy-cucumber' - I might actually give up and try again on Monday
when it might all make more sense!)

- Korny

On Fri, Mar 13, 2009 at 5:55 PM, Korny Sietsma <korny at sietsma.com> wrote:

> I'm a bit confused.
> I have a scenario similar to (numbered for clarity):
>   Scenario: view basic
> 1)     Given I am logged in as 'fred'
> 2)      When I navigate to the 'foo' tab
> 3)      And I select the 'bar' node
> 4)      Then the node 'baz' is displayed
>
> Now, when I have a problem that the 'foo' tab isn't actually visible, I
> expect the scenario to fail at step 2.
> It seems that it *does* fail, but it also runs steps 3 and 4 silently.
> The trouble is that without the 'foo' tab, the 'bar' and 'baz' nodes don't
> exist.  But I have code behind the scenes that tracks selenium errors and
> takes screenshots and generates log messages, which I don't really want - I
> only care about the error at step 2.  (And I'm also wasting time at steps 3
> and 4 waiting for selenium stuff to time out...)
>
> Is this the expected behaviour?  I did some digging in the code, and it
> seems the core functionality is in executor.rb:
>     def visit_step(step)
>       unless @pending || @error
>         begin
> ...
>           step.execute_in(@world, regexp, args, proc) unless @dry_run
>           @after_step_procs.each{|p| p.call_in(@world, *[])}
>           formatters.step_passed(step, regexp, args)
> ...
>         rescue => e
>           @failed = true
>           @error = step.error = e
>           formatters.step_failed(step, regexp, args)
>         end
>       else
>         begin
> ...
>           step.execute_in(@world, regexp, args, proc)
>           formatters.step_skipped(step, regexp, args)
> ...
>         rescue Exception
>           formatters.step_skipped(step, regexp, args)
>         end
>       end
>     end
>
> From reading this, it seems that once @pending or @error are set, following
> steps will indeed still be run, but the output will be displayed as if they
> were skipped.
>
> Is this right?  Is there some way to bypass this and say "this is a serious
> error, abort this scenario and jump to the next one" ???
>
> - Korny
>
> --
> Kornelis Sietsma  korny at my surname dot com
> kornys on gmail, twitter, facebook, etc.
> "Every jumbled pile of person has a thinking part
> that wonders what the part that isn't thinking
> isn't thinking of"
>



-- 
Kornelis Sietsma  korny at my surname dot com
kornys on gmail, twitter, facebook, etc.
"Every jumbled pile of person has a thinking part
that wonders what the part that isn't thinking
isn't thinking of"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090313/dfb6d467/attachment-0001.html>


More information about the rspec-users mailing list