Cucumber

It’s well known that I am not a fan of Cucumber - tends to make me come out in hives. However, I’ve come across a very cool Cucumber of the non- vegetable Ruby (and hence not edible) variety that has some awesome possibilities. So what is Cucumber? It’s a behaviour driven development and testing tool that uses plain English language to describe testing scenarios (a la RSpec) and do the resulting “story running”. But the goodness isn’t limited to those rascally developers. It’s an excellent tool for sys-admins to do systems testing. And to prove it along comes cucumber- nagios. Developed by Lindsay Holmwood (who is an open source guy in Australia and a Puppet person) it is designed to allow Cucumber to output using the Nagios plug-in API. First, Lindsay has some cool stuff in this blog post but here’s another example I cooked up. Hypothetically, we might have a web page created on our site and we need to ensure users can click through to a link on it. We also want to be sure that linked page contains a section with some information we want to share with our customers:

Feature:
  It should be up
  And I should be able to reach the interest rates page
  And it should contain a "Daily Rates" section

  Scenario: Reaching the rates page
    When I visit "www.interbanking.com.au"
    And I click on "Rates"
    Then I should visit "www.interbanking.com.au/rates.html"
    And then I should see a section called "Daily Rates"

This would then be run:

$ cucumber-nagios features/interbanking.com.au/rates.feature
Critical: 0, Warning: 0, 4 okay | value=4.000000;;;;

You can see it would return an appropriate Nagios plug-in output. And voila! Cheap and easy website script testing which plugs into our enterprise monitoring system. Multiply this with all of the other things Cucumber can script and story board and you have a powerful engine to monitor complex elements of your environment. P.S. Related to this that I stumbled across recently is Cucumber and Dash integration. Dash is a mechanism for creating and measuring custom metrics and Bradley (@ RailsMachine) has a couple of posts that show how to integrate Sensor, Cucumber, Dash and cucumber-nagios!

comments powered by Disqus