Debugging in Cucumber
17 Jul 2010
As a relative newb’ to cucumber I realize there’s a lot to get caught up on. The one thing I do know is that there’s a lot that I don’t know. Having said that, when I run into a barrier or an issue and I want to dig into the source to figure things out, what do you do?
You break out ruby-debug, of course.
Add require ‘ruby-debug’ to features/support/env.rb and throw a breakpoint into your step definitions.
That’s all well and good, and it works just fine. But what do you look for while you’re in there? I spent the better part of an evening looking for how I could sniff around the html source cucumber was testing against and couldn’t find it. Lots of searching for how to pear into @response and @request – which end up being nil as far as I can see.
I had no idea.
Until I read this post from the LoED on how to test your source’s validity. In there was the answer:
Baby steps. I’ll figure this all out yet.