June 2007
Intermediate to advanced
294 pages
8h 6m
English
Up until this point, our testing scripts have been relatively primitive, and to a very large degree, we have rolled our own testing solutions. It’s silly to do that repeatedly, especially in computer programs, because good programming languages allow you to express abstract concepts abstractly, as well as to adapt general-purpose tools in code libraries to your specific needs.
Ruby has a general-purpose testing library called Test::Unit. Here is code that allows you to use its power to test the script temperature_converter.rb.
#!/usr/bin/env ruby
# test_temp_converter.rb
❶ require 'temperature_converter'
require 'test/unit'
❷ class Tester < Test::Unit::TestCase Unit Testing ...Read now
Unlock full access