Adding Tests to Legacy Rails Apps

Evan (Rabble) Henshaw-Plath, Hacker, Independent

Date: Friday, May 18
Time: 1:50pm - 2:40pm
Location: Oregon Ballroom 202

Most first-time Rails apps are built before a developer understands their importance. Testing is painful in many frameworks and ignored when many people switch to using rails.

Ruby on Rails encourages regression testing in the framework by making it easy and creating the tests out of the box. Despite the encouragement, many Rails developers jumped ahead to the coding and left testing to languish for months or years untouched.

This talk will provide a pragmatic approach to adding testing to your existing Rails application. Built on real-world experience adding test coverage to large Rails applications. The talk will cover the benefits of adding incremental test coverage to an existing app and techniques for getting started on testing a legacy app.

Techniques for testing a legacy app:

  • Steps to adding tests
  • How to get on the path of writing and using tests
  • Using tests in deployment
  • Adjusting release cycles with expanded test coverage
  • Integrating testing in to the developer's workflow

Tools for testing a legacy app:

  • Building tests from the logs
  • Evaluating test coverage using rake and rcov
  • Using zentest to build out tests quickly
  • Autotest for setting up cia and continuous_builder
  • RIG: Rails Integration Generator

Even a few tests with the right setup can help improve a project if they are integrated into, and run as part of, the development process. There is hope for the legacy Rails app without tests.

Conference News and Coverage