Make cucumber open the browser with the current page
The Cucumber Book describes a really nifty trick when testing web-pages: open the browser when a step fails. This is a feature provided by cucumber itself.
Add a support file features/support/debugging.rb
:
And add launchy to your gemfile, and bundle install
. (or install it with whatever else
you use).
This will save the page that cucumber is looking at, then open it in your browser. Works fine, untill you have a large suite of features and some refactoring breaks many features. Having to close twenty tabs in your browser after each run is counterproductive and often really frustrating.
I solved this with a flag that allows me to fire this debugging-trick only when I need it. When I have a failing scenario, and I want to investigate it by inspecting the page, I run my cucumber with an additional environment-variable:
The debug=
syntax allows for more simple tricks too. Like debug=pp
:
Simple trick, works like a charm.