2009-11-26 18 views

回答

1

你应该看看github.com/TwP/turn - 它产生彩色输出,按照测试方法输出PASS/FAIL,最重要的是,它在发生错误后立即显示相关故障/错误,而不是“在所有点后面”。

在Github的Readme有所有相关信息。

0

你可能想

ruby test/test_name.rb --verbose 

,并查看测试/单元的其他选项,您可以运行

ruby test/test_name.rb --help 
+0

我的意思是我正在运行一个rake任务,并希望在点之前看到测试类的名称。 – Roger 2009-11-27 05:27:40

0

测试单元gem会添加更好的失败消息,以确定哪个测试文件发生故障。只要它包含在您Gemfile

group :development do 
    gem 'test-unit' 
end 

仅供参考,以获得彩色输出,您可以用TESTOPTS

bundle exec rake test TESTOPTS='--use-color' 

运行默认耙任务,或者可以通过创建自定义rake任务有更多的控制使用Rake::TestTask

https://github.com/jimweirich/rake/blob/master/lib/rake/testtask.rb

# lib/tasks/my_custom_test_runner.rake 
require 'rake/testtask' 

Rake::TestTask.new("test:my_custom_test_runner") do |t| 
    t.libs << "test" 
    t.test_files = FileList['test/test*.rb'] 
    t.verbose = true 
    t.opts = "--use-color" 
end 

设置t.verbose = true将在输出中包含用于根据您定义的rake任务运行测试的命令。

相关问题