问题描述:

I am using Rubymine 6.0 to write cucumber tests using ruby and am very new to it.

When I run a test and a step does not pass , rubymine skips that step and fails the scenario.

This makes perfect sense to me when am running hundreds of tests and I want that to happen the way it is now.

But, How do I make the test pause on that failed step or that particular line of code when running the test in debug mode?

Is there a way around than to put a break point on the step before it fails and then step into it ?

I want the test to pause on that particular point where it failed and let me take over.

Thanks,

RK

网友答案:

All assertions in all testing frameworks that I'm familiar with raise exceptions of certain types when the expectation is not met (or assertion fails) in the test. RubyMine lets you configure the "exception breakpoints" - to have it suspend execution when an exception of a certain type is raised.

I've just tried on RubyMine 6.0.2 with Ruby 2.1 and latest rspec. Rspec raises RSpec::Expectations::ExpectationNotMetError when expectation is not met (according to the rspec's source code), but for some reason RubyMine doesn't stop on that breakpoint - it doesn't work!

Another solution that did work for me was to set a regular breakpoint in the rspec's source code file: rspec-expectations-2.14.0/lib/rspec/expectations/fail_with.rb, in the method "fail_with" - this method is called when any assertion/expectation fails.

I'm sure you could do something like that with Cucumber: just debug into the assertion method's source code and put a breakpoint there.

相关阅读:
Top