How to output names of ruby unit tests

白昼怎懂夜的黑 提交于 2019-11-30 05:15:36

If you're testing in rails you can use

rake test TESTOPTS=-v

Run unit test with verbose option.

test.rb -v v

or

test.rb --verbose=verbose

Output:

Loaded suite C:/test
Started
test_something(TC_MyTest): .

Finished in 0.0 seconds.

1 tests, 1 assertions, 0 failures, 0 errors

Command line options do not work if you are creating your own test runner:

Test::Unit::UI::Console::TestRunner.run(TC_MyTest)

You will have to specify verbosity in test runner. Test::Unit::UI options are:

SILENT = 0, PROGRESS_ONLY = 1, NORMAL = 2, VERBOSE = 3.

So, for verbose:

Test::Unit::UI::Console::TestRunner.run(TC_MyTest, 3)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!