LoginSignup
7

More than 5 years have passed since last update.

Test::Unitで実行中のテストケースを表示する

Last updated at Posted at 2012-09-17

普通に実行してしまうと、実行中のテストケースを表示してくれない。

$ bundle exec ruby some_test.rb
Run options: 

# Running tests:

...

Finished tests in 1.017405s, 2.9487 tests/s, 1.9658 assertions/s.

普通はこれでも十分なんですが、セグメンテーションフォールトとかの低レベルなバグを追っているときだとちょっとつらい。

そういうときは-vオプションを使ってやればいい。

$ bundle exec ruby some_test.rb -v
Run options: -v

# Running tests:

SomeTest#test_a = 0.00 s = .
SomeTest#test_b = 1.01 s = .
SomeTest#test_c = 0.01 s = .

Finished tests in 1.017389s, 2.9487 tests/s, 1.9658 assertions/s.

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

rake testの場合はTEST_OPTS環境変数を設定してやればいい。

$ TEST_OPTS='-v' bundle exec rake test

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7