るりまサーチ

最速Rubyリファレンスマニュアル検索!
3件ヒット [1-3件を表示] (0.156秒)
トップページ > クエリ:I[x] > クエリ:teardown[x]

別のキーワード

  1. _builtin to_i
  2. fiddle to_i
  3. matrix elements_to_i
  4. matrix i
  5. csv to_i

ライブラリ

クラス

キーワード

検索結果

MiniTest::Unit::TestCase#teardown (21101.0)

各テストケースの実行後に実行するメソッドです。

各テストケースの実行後に実行するメソッドです。

サブクラスで再定義します。

minitest/unit (6018.0)

ユニットテストを行うためのライブラリです。

...ユニットテストを行うためのライブラリです。

=== 使い方

minitest/unit は以下のように使います。

テスト対象のソース (foo.rb) を用意します。

class Foo
def foo
"foo"
end
def bar
"foo"
end
end

次にユニットテス...
...行された後には teardown メソッドが必ず実行されます。

minitest/unit を Kernel.#require しただけではテストが自動実行されません。

require 'minitest/unit'
require 'foo'

MiniTest::Unit.autorun

class TestFoo < MiniTest::Unit::TestCase
def setup...
...@foo = Foo.new
end
# teardown はあまり使わない
def teardown
@foo = nil
end

def test_foo
assert_equal "foo", @foo.foo
end

def test_bar
assert_equal "bar", @foo.bar
end
end

または MiniTest::Unit.autorun を省略して以下...

test/unit (6012.0)

ユニットテストを行うためのライブラリです。

...してください。

* Test::Unit - Ruby用単体テストフレームワーク: https://test-unit.github.io/

なお、2.2.0より前のtest/unit は当時バンドルしていた minitest/unit を使って再実装し
ていましたが、上記のtest/unitと完全な互換性がある訳で...
...クの歴史(2014年版) https://www.clear-code.com/blog/2014/11/6.html
* RubyKaigi 2015:The history of testing framework in Ruby https://www.clear-code.com/blog/2015/12/12.html

=== 使い方

Test::Unit は以下のように使います。

まずテスト対象のソース(foo.rb)が必...
...呼ばれます。実行されたあとには、teardown メソッドが必ず呼ばれます。

require 'test/unit'
require 'foo'

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

# def teardown
# end

def test_foo
assert_...