Forum: RSpec Cucumber seems to be running steps after failed steps ...

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D86508251e48b986057d34bf9ae3b6b3?d=identicon&s=25 Kornelis Sietsma (korny)
on 2009-03-13 08:30
(Received via mailing list)
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
D86508251e48b986057d34bf9ae3b6b3?d=identicon&s=25 Kornelis Sietsma (korny)
on 2009-03-13 08:37
(Received via mailing list)
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
0be0e4aa42aacd9a8a95c792de273ca7?d=identicon&s=25 Aslak Hellesøy (aslakhellesoy)
on 2009-03-13 09:01
(Received via mailing list)
On Fri, Mar 13, 2009 at 8:05 AM, Korny Sietsma <korny@sietsma.com>
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/tick...

Aslak
This topic is locked and can not be replied to.