Be Genius

me

Bo Jeanes

I am an Australian full-stack developer living and working in San Francisco. I strongly advocate open-source software and the community around it. I am a tool maker. I currently work primarily in Ruby and Rails but do as much Clojure, Go, and Javascript as I can.

Automatically open the last page for failed scenarios

When writing new Cucumber scenarios, developers will usually start with a failing scenario, incrementally making it pass, step by step. If this is a common workflow for you, you’ll probably have noticed a trend of having to re-run it each time a new step is failing, adding something like Then show me the page after the last passing step to see why the story is currently failing.

Chendo and I came up with a nifty little solution in just a few lines that really helps this process of seeing what webrat sees when a scenario fails. Throw this snippet of code in a file in your features/support/ directory:

After do |scenario|
  if scenario.respond_to? && scenario.status == :failed
    save_and_open_page
  end
end

Comments

None yet

You need to login with GitHub in order to comment.