Further Adventures in Rails Testing
Yesterday I went to “Hack Day ‘Effective Testing for Rails Projects’” at Viget Labs in Falls Church. Â After Ruby DCamp I decided I was severely lacking in testing skills as a developer and I’m trying to do something to remedy that. Â With the promise of “building a simple Rails application and a pair-programming environment” as well as “demonstrating effective testing techniques” I was sold.
I come from a Quality Assurance background so I am used to testing software as it is written. Â Just in the past week have I felt like I am beginning to grasp testing software while it is written. Â The live coding at Hack Day helped further that. Â The example application we used was “Out To Lunch,” which is a simple app that utilizes the Yelp API to search for locations to eat and then will tell you where to eat lunch each day.
The session was lead by Patrick Reagan and Matt Swasey, who did “Ping Pong Pairing” a type of paired programming I’d never seen before. Â In ping pong pairing one developer writes a single test and then runs it and it fails. Â Then the 2nd programmer writes code to make the test pass. Â After that the first programmer writes another test and so on. Â I’m a little bit competitive in nature and I think this would be a great way to pair. Â Patrick and Matt each had their own keyboard and mouse and think that helps make the switching in this case go more smoothly.
We started with the Out to Lunch application from the beginning initially writing a test that asserted “should be able to accept a zip code” in the YelpSearcher class. Â From there the code was written to accept the ZIP code and so on. Â It was interesting to watch people work together and troubleshoot. Â Since I’m fairly new to Ruby on Rails just watching people programming in it teaches me new techniques. Â I also got some term definitions further straight in my head such as stub “a dummy object that will return whatever you want.” Â I had never thought about when and where I should be using stubs in my testing before but now it really makes sense for unit tests, since you would want to break the code down to the simplest action possible.
I learned a ton in the three hour class and will be checking out Ruby Hack Night soon.
More from Maploser
- Layar for the iPhone
- My Personal Map
- Ruby DCamp Day One
- GeoNerds in the Wave
- D.C. OpenStreetMap Mapping Party
Maploser Recommends
- WordPress as a CMS (Adam Estrada)
- Customizing config.xml in the ESRI FlexViewer (Adam Estrada)
- Open Street Map (take 1) (Adam Estrada)
September 27, 2009
Tags: hacknight, rails, Ruby, testing, viget Posted in: Ruby, TDD

Leave a Reply