I’m a bit confused.
I have a scenario similar to (numbered for clarity):
Scenario: view basic
-
Given I am logged in as 'fred'
-
When I navigate to the 'foo' tab
-
And I select the 'bar' node
-
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