るりまサーチ

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

別のキーワード

  1. kernel test
  2. _builtin test
  3. rubygems/test_utilities tempio
  4. rubygems/test_utilities fetcher=
  5. testtask test_files=

ライブラリ

クラス

キーワード

検索結果

test/unit (26210.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)が必要です...
...ruby test_foo.rb

Loaded suite test_foo
Started
F.
Finished in 0.022223 seconds.

1) Failure:
test
_bar(TC_Foo) [test_foo.rb:16]:
<"bar"> expected but was
<"foo">.

2 tests, 2 assertions, 1 failures, 0 errors, 0 skips

test
_bar...

MiniTest::Unit#failures -> Fixnum (21101.0)

失敗したアサーション数を返します。

失敗したアサーション数を返します。

MiniTest::Unit#failures=(count) (9101.0)

失敗したアサーション数をセットします。

失敗したアサーション数をセットします。

@param count 件数を指定します。

minitest/unit (6120.0)

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

...ラリです。

=== 使い方

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

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

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

次にユニットテスト (test_foo.rb) を書きます。
テストを...
...) の名前はすべて "test" で始まる必要があります。
テストメソッドが実行される前には setup メソッドが必ず実行されます。
テストメソッドが実行された後には teardown メソッドが必ず実行されます。

minitest/unit を Kernel.#requir...
...が実行されます。

$ ruby test_foo.rb
Loaded suite test_foo
Started
F.
Finished in 0.000940 seconds.

1) Failure:
test
_bar(TestFoo) [test_foo.rb:20]:
Expected "bar", not "foo".

2 tests, 2 assertions, 1 failures, 0 errors, 0 skips

test
_bar だけテストしたい場...