&tag(Ruby1.9/UnitTest);
*目次 [#q03978c7]
#contents
*参考情報 [#kcdcf4c6]
-[[library test/unit:http://doc.ruby-lang.org/ja/1.9.2/library/test=2funit.html]]


*テストのファイル名 [#k1c338a9]
-test_foo.rbとする。

*テストの実装 [#j1810dcf]
-テスト対象クラスをfooとするとき、次のように実装する。
#pre{{
require 'test/unit'
require 'foo'

class TC_Foo < Test::Unit::TestCase
  def setup
    @obj = Foo.new
  end

  # def teardown
  # end

  def test_foo
    assert_equal("foo", @obj.foo)
  end
  def test_bar
    assert_equal("bar", @obj.bar)
  end
end
}}


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS