Before you start
Test-first programming is a promising extension of agile programming methodologies that let you write code with more confidence, refactor easily, and readily adapt your code to new requirements. This tutorial gets you started with the test-first programming model using the Ruby programming language. After you've completed the tutorial, you should be well on your way to producing robust, functional code more quickly and with more confidence.
The code examples in this tutorial come from the r43 library, a wrapper around the 43 Things API (see Resources).
This tutorial is dedicated to the memory Masuru Ishii -- a Japanese Rubyist and the father of unit testing in Ruby. He died in the 25 April 2005 rail disaster in Amagasaki, Japan.
To complete this tutorial, you need:
- A working installation of Ruby (V1.8.2 is preferred).
- A basic understanding of the Ruby programming language, including the ability to write small programs.
If you're on a Linux® or Mac OS X machine, you're almost certainly covered for the first prerequisite. If your distribution doesn't ship with Ruby, it's easy to build from source (see Resources), but you should let the distributor know that you want it in the next release. If you're working on a Microsoft® Windows® system, it has a nice one-click installer (see Resources).
If you don't already know Ruby, Resources contains links to tutorials, books, and other literature to get you started. You can probably learn enough just by completing this tutorial, though. Ruby is very easy to read.




