Presentation is loading. Please wait.

Presentation is loading. Please wait.

Unit Testing.

Similar presentations


Presentation on theme: "Unit Testing."— Presentation transcript:

1 Unit Testing

2 Unit Testing Venkat’s rant on Unit Testing What is it? Benefits
Ruby’s emphasis on it

3 Your Test Your Test inherits from Test::Unit::TestCase
require ‘test/unit’ Use assert methods like assert_equals Test methods start with test prefix setup and teardown methods

4 Running Tests ruby testfilename.rb
ruby testfilename.rb –name test_name

5 Asserts assert assert_nil assert_not_nil assert_equal assert_not_equal
assert_in_delta assert_raise assert_nothing_raised assert_instance_of assert_kind_of assert_respond_to assert_match assert_no_match assert_same assert_not_same assert_operator assert_throws assert_send flunk

6 Unit Tests

7 Organizing Your Tests Put your tests in a test directory parallel to the code directory To run your tests from different directories you need to help ruby located it The above modified $: (variable that represents load path) so that it gets the ../src directory relative to where the test is

8 The $: magic

9 Organizaing your tests


Download ppt "Unit Testing."

Similar presentations


Ads by Google