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’


Read Full Post | Make a Comment ( None so far )

Recently on Chinnakarupan’s Weblog...

Ruby – Numeric

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

ruby rake

Posted on April 21, 2008. Filed under: Uncategorized |

Ruby : Math

Posted on April 21, 2008. Filed under: Uncategorized |

rails basics

Posted on April 21, 2008. Filed under: Uncategorized |

ruby gems

Posted on April 20, 2008. Filed under: Uncategorized |

$0 , __FILE__

Posted on March 18, 2008. Filed under: Uncategorized |

Splat Operator in Ruby

Posted on March 18, 2008. Filed under: Uncategorized |

Structures in Ruby

Posted on March 18, 2008. Filed under: Uncategorized |

Ruby – Date/Time

Posted on March 13, 2008. Filed under: Uncategorized |

Ruby / Regular Expression

Posted on March 12, 2008. Filed under: Uncategorized |

  •  

    July 2009
    M T W T F S S
    « Jun    
     12345
    6789101112
    13141516171819
    20212223242526
    2728293031  
  • My Fav

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