如何输出 ruby 单元测试的名称
我有一个单元测试(示例已修改 Test::Unit 文档)
require 'test/unit'
class TC_MyTest < Test::Unit::TestCase
def test_something
assert(true)
end
end
当我执行它时,我得到:
Loaded suite C:/test
Started
.
Finished in 0.0 seconds.
1 tests, 1 assertions, 0 failures, 0 errors
我想得到这样的东西(test_something
被输出):
Loaded suite C:/test
Started
test_something
.
Finished in 0.0 seconds.
1 tests, 1 assertions, 0 failures, 0 errors
I have a unit test (example is modified Test::Unit documentation)
require 'test/unit'
class TC_MyTest < Test::Unit::TestCase
def test_something
assert(true)
end
end
When I execute it, I get:
Loaded suite C:/test
Started
.
Finished in 0.0 seconds.
1 tests, 1 assertions, 0 failures, 0 errors
I would like to get something like this (test_something
is outputted):
Loaded suite C:/test
Started
test_something
.
Finished in 0.0 seconds.
1 tests, 1 assertions, 0 failures, 0 errors
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果你在 Rails 中测试,你可以使用
If you're testing in rails you can use
使用 verbose 选项运行单元测试。
或
输出:
Run unit test with verbose option.
or
Output:
如果您正在创建自己的测试运行程序,则命令行选项不起作用:
您必须在测试运行程序中指定详细程度。 Test::Unit::UI 选项 是:
SILENT = 0,PROGRESS_ONLY = 1,NORMAL = 2,VERBOSE = 3。
因此,对于详细:
Command line options do not work if you are creating your own test runner:
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: