We use Cucumber-Nagios at The Frontier Group to monitor live web applications and web sites. It’s the natural extension to the integration testing we conduct on our applicaitons as we develop them, and it gives us a deeper insight into an applications real-time availability and responsiveness… or so I thought.

Due to an oversight on my part, the Cucumber feature that we use to search this blog was failing “in real life” but passing according to Cucumber-Nagios. I was searching for a text string that should have appeared only after conducting a successful search of the articles, however it was also appearing in the list of popular articles on the sidebar. Whoops!

After the test started failing for real, because the blog post was no longer referenced in the sidebar, I dug deeper in an attempt to find the problem.

In the end Aaron did most of the hard work, and tracked the problem down to webrat not submitting the form properly. As such the response data that was being parsed was incorrect.

Here’s the feature file:

Can’t see this Gist? View it on Github!

The trick that we used (and it is a nasty hack, to be sure) is to fool webrat into operating in “Rails mode”, whereby it POSTs the form properly. I added the last four lines to features/support/env.rb and it’s done the trick.

Can’t see this Gist? View it on Github!

So if you’re having a problem with webrat posting data, maybe this will help you. Alternatively, if you have a suggestion on how this could be fixed in a cleaner way, please leave a comment.