Ruby, Testing
In Ruby -> Test::unit::TestCase is easy
require ‘test/unit’
the name of the class to be tested is Roman then the testing class will TestRoman < Test::Unit::TestCase
and a simple method
def test_simple
assert_equal (“expected_result”, call_to the method of class to be checked –>actual result)
end
for testing a particular method….
ruby test_roman.rb –name “name of the method”
location of the test file should
$:.unshift File.join(File.dirname(__FILE__),”..”,”lib”)
require….the file to be tested (since require will bring the location of the file in previous line)
Test suite…
require ‘test/unit’ followed by all the test file names…it is as simple
require ‘test_roman’
require ‘test_music’