Tuesday, February 24, 2009

Cucuber and Selenium

In my latest contract I have been developing automated tests for a Rails application using Selenium and Cucumber. I was reasonably comfortable with Selenium, or so I thought but Cucumber was another story, no pun intended.

Cucumber allows you to define tests in natural language such as:
Given I am a valid user
When I log in
Then I should see my todo list


Pretty cool but the real beauty is in creating a DSL that lets you spit out tests nearly as fast as you can think of them. This is where the true benefit of Cucumber + Selenium really shines. Yes it takes significant time to build up the DSL but over time, you have a vocabulary that allows you to not only test the application but in true BDD form, specify it as well.

More to come over the next few weeks.