Cucumber seems to be running steps after failed steps


#1

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

#2

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

#3

On Fri, Mar 13, 2009 at 8:05 AM, Korny S. removed_email_address@domain.invalid
wrote:

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!)

Yes, this bug was fixed after 0.1.16, so you’re better off with one of
the
snapshot gems.
http://rspec.lighthouseapp.com/projects/16211/tickets/90-really-skip-skipped-steps

Aslak