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.

Pausing Cucumber Scenarios to Debug

Continuing what I started with my post last light, I’ve got another tip for developing productively when using Cucumber.

I’m going to show you a simple way to pause cucumber stories in order to investigate the current state of your application at that point.

AfterStep('@pause') do
  print "Press Return to continue"
  STDIN.getc
end

Then just tag any Cucumber feature or scenario with @pause. After the first step is run, the scenario will stop running and you can do whatever you like before proceeding.

My favourite tactic is to combine the @pause tag with @selenium tag to have WebDriver stop driving FireFox for a moment and let me click around in the application or inspect the HTML/CSS at that point.

My next post will be about enabling FireBug in the "WebDriver" profile to help inspecting the web page when you’ve paused a scenario.

Comments

  1. Hey! Complete n00bie here.. Which file do I add that code snippet to? Great blog by the way. Definitely learning stuff from you!

    by Kat Aquino on

You need to login with GitHub in order to comment.