Ruby, Testing

Posted on June 1, 2008. Filed under: Uncategorized |

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’

Make a Comment

Make a Comment: ( None so far )

blockquote and a tags work here.

  •  

    June 2008
    M T W T F S S
    « Apr    
     1
    2345678
    9101112131415
    16171819202122
    23242526272829
    30  
  • My Fav

Liked it here?
Why not try sites on the blogroll...