Ruby测试单元:多个脚本,一个输出

时间:2012-01-27 16:20:19

标签: ruby testunit

我可以从多个脚本运行多个测试用例但是有一个输出显示“100%Pass”或“X Failed”并列出失败的测试吗?

例如,我希望看到类似的内容:

>runtests.rb all #runs all the scripts in the directory
Finished in 4.523 Seconds
100% Pass

>runtests.rb category #runs all the scripts in a specified sub-directory
Finished in 2.1 Seconds
2 Failed:
test_my_test
test_my_test_2
1 Error:
test_my_test_3

1 个答案:

答案 0 :(得分:2)

我使用内置MiniTest::Unit以及属于ZenTestautotest命令,并获得如下输出:

autotest
/Users/tinman/.rvm/rubies/ruby-1.9.2-p290/bin/ruby -I.:lib:test -rubygems -e "%w[test/unit tests/test_domains.rb tests/test_regex.rb tests/test_vlan.rb tests/test_nexus.rb tests/test_switch.rb tests/test_template.rb].each { |f| require f }"
Loaded suite -e
Started
........................................
Finished in 0.143375 seconds.

40 tests, 276 assertions, 0 failures, 0 errors, 0 skips

Test run options: --seed 62474

这与您所说的相似吗?