Showing posts with label Testing. Show all posts
Showing posts with label Testing. Show all posts

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.

Friday, September 26, 2008

yet another post...

So here is another of my very infrequent posts. Not that anyone reads them. I sometimes need to write them anyway. Recently I have been focusing a lot of time and energy toward updating and improving my testing tools & skills. In my current contract I am attempting to automate the testing of a very sophisticated web app using Selenium RC - Ruby. This app's UI is nearly all GWT and that is proving to be the biggest challenge. From my understanding, GWT does not generate element IDs by default and thus I find myself having to leverage Selenium IDE to get the xpaths for each element, and believe me they are not pretty.

On another front I am diving into RSPEC & RCOV which I find to be a double edged sword. Perhaps as my skills improve it will have a big upside but for now it is time consuming. I cannot remember where I saw it, on someones blog but the key words were "test your own code" so by default I would probably not maintain 100% coverage which contradicts most of my 20+ years of experience. The thing I really like about RSPEC is the ability to tease requirements out. Being able to have a client give me a terse rudimentary description of what an object should or shouldn't do seems like a big win. The hard part, just as with any testing, is just the commitment of doing it. It always seems that you are spending too much time developing specs and not enough time writing code. I have not broached the stories yet, the specs themselves are keeping me busy.

On a personal note, I turned 50 this past Wednesday, do I feel older? Not really but as scary as it sounds, I see more of my parents in me than I ever thought I would, both the good and the not-so-good. Nature or nurture, whatever the reason there it is.