Automated Testing with Ruby

December 8th, 2008

The fifth Australian Open Source Developers’ Conference was held last week in Sydney. In addition to helping organise the conference, I was fortunate enough to be one of the Ruby presenters.

View SlideShare presentation or Upload your own. (tags: osdc osdc2008au)

Naturally, these slides were designed to assist my presentation rather than contain all the content. Indeed, the inclusion of some of the slides may beg some questions so I thought it may be helpful to add some explanation here.

Reminiscing about Testing

Each of us programmers is on a specific journey, especially when it comes to testing. Early in my professional career I was taught how to unit test program modules written in PL/I. However, the drivers for those tests had to be written in Job Control Language (JCL) – an experience I am not in a hurry to repeat.

Many years later, having escaped from working on mainframes, I discovered JUnit. This was a fundamental tool in my early experience of test driven development and refactoring. When I began exploring Ruby and Rails, I was eventually introduced to autotest, which I considered another quantum leap forward in the realm of automated testing.

Testing Tools

In 25 minutes there was obviously a limit to the number of Ruby testing tools I could cover. So, having quickly explained the benefit of autotest and touched upon Test::Unit, I moved on to describe some tools that I have used in the last year.

RSpec

To make sure the audience was still awake, at this point I showed a cute photo of our family dog. My lame excuse was that he exhibits a wide range of behaviours and RSpec is all about specifying behaviour. My main example of using RSpec was for specifying a controller. This led on to a brief digression into consider what makes a good test and the use of mock objects to isolate unit tests and make them faster by avoiding unnecessary database I/O.

Integration Testing with Cucumber, Webrat and Selenium

I was pleased to be able to include Cucumber, Webrat and Selenium in my talk. It’s only fairly recently that I started using Cucumber in conjunction with Webrat or Selenium and I’m impressed. As Mike Koukoullis showed in his subsequent talk, developing with Cucumber is a very powerful approach, which fosters clear description of intent before development of any feature.

Speaking of other talks, Alister Scott used a lightning talk to share his enthusiasm for Watir, which looks like a good alternative to Selenium.

Test Data with Machinist

After briefly relating the motivation for developing alternatives to relying on fixtures for test data, I described Machinist, an elegant tool recently developed by Pete Yandell. When used in conjunction with Sham, Machinist provides a neat way of generating “blueprints” that can be used in Cucumber steps.

Other Tools

I briefly mentioned JavaScript unit testing tools that are the subject of a blog post by Dr Nic as well as touching upon Shoulda, which is well written up by Dave Thomas.

Philosophy

To round out my talk, I thought it was important to offer a few philosophical thoughts. In a nutshell my view is that, whilst it is important to remember that automated testing is just one of many error removal approaches, we can all benefit from investing in automated testing.

In my case, as well as practicing using these tools, I’m also looking forward to reading the upcoming title The RSpec Book by David Chelimsky and others.

Tags: testing osdc ruby conferences | Comments (0)

OSDC 2008 Earlybird registration closing this Friday

October 28th, 2008

In exactly five weeks this year’s Open Source Developers’ Conference starts. As one of the organising committee it would be remiss of me not to alert you to the fact that if you register by this Friday you can take advantage of earlybird pricing.

The Facts

31st October: Earlybird registration closing

2nd December: Google Hackathon
3rd – 5th December: Conference Program
3rd December: Conference Dinner

Where

SMC Conference and Function Centre
66 Goulburn St
Sydney NSW 2000

The Main Conference

The Open Source Developers’ Conference 2008 is a conference run by open source developers, for developers and business people. This year we have talks covering Apache, Java, Ruby, Perl, PHP, Python, Testing and much more. Our keynote speakers this year are:

  • Larry Wall, the creator of Perl
  • Chris DiBona, Open Source Programs Manager for Google
  • Anthony Baxter, Python Evangelist
  • Pia Waugh, Consultant, Waugh Partners
  • Andrew Tridgell, Founder, Samba Team

Speakers on Ruby topics include:

  • Michael Koukoullis: “Story-based Web Development”
  • Dr Nic Williams: “How to package your Ruby code for distribution and sharing”

Check out the program for more information.

Google Hackathon

The day before the main conference, there will be an optional event. The Google Hackathon will consist of 3 coding workshops during the day with attendance limited to a maximum of 100 people/workshop. To register for any of the workshops, you must have registered for the 3 day OSDC 2008 main conference.

Our Sponsors

Naturally the organising committee is most grateful to our sponsors: Google, Corporate Express, Sun Microsystems, Strategic Data, Obsidian Consulting Group, IBM, Zacware/Freeway, ACS, Net Logistics, GROX, UTBox, Internode and Linux Magazine.

Tags: osdc | Comments (1)