是否可以增强 rake 测试任务并将测试结果合并在一起? [英] Is it possible to enhance the rake test task and merge test results together?
问题描述
我正在为我的 sidekiq 工作人员编写测试,我希望它们在我在终端中键入rake"时运行.我有这个工作 - 我在我的 Rakefile 中添加了以下内容:
I am writing tests for my sidekiq workers and I want them to run when I type "rake" in the terminal. I have that working - I added the following to my Rakefile:
namespace :test do
Rake::TestTask.new(:workers) do |t|
t.libs << "test"
t.pattern = 'test/workers/**/*_test.rb'
end
end
Rake::Task[:test].enhance ["test:workers"]
当我运行 rake 时,我的输出是这样的:
When I run rake I get something like this as my output:
Run options: --seed 51172
# Running tests:
SS
Finished tests in 0.005594s, 357.5259 tests/s, 0.0000 assertions/s.
2 tests, 0 assertions, 0 failures, 0 errors, 2 skips
Run options: --seed 17561
# Running tests:
S............................................SSSS..SSSSS......
Finished tests in 2.037526s, 30.4291 tests/s, 45.6436 assertions/s.
62 tests, 93 assertions, 0 failures, 0 errors, 10 skips
S 字符是跳过 - 我还没有完成所有的测试.所以我的问题基本上是 - 有没有办法在增强后合并两组测试?我应该做一些与增强不同的事情吗?
The S characters are skips - I haven't finished all of my tests yet. So my question is basically - is there a way to merge the two sets of tests after enhancing? Should I be doing something different than an enhance?
如果我做错了什么,请告诉我,感谢您阅读本文.以防万一:Rails 4 w/Ruby 2.0
If I'm doing anything blatantly wrong please let me know, and thanks for reading this. And just in case it is needed: Rails 4 w/ Ruby 2.0
推荐答案
试试这个,更改以下内容:
Try this, change the following:
Rake::TestTask.new(:workers) do |t|
为此:
Rails::TestTask.new(:workers) do |t|
这是一个小改动,但为我解决了问题.这意味着您的整个测试套件将使用合并的输出运行.
It's a small change, but fixes the problem for me. It means your entire test suite will run with merged output.
这篇关于是否可以增强 rake 测试任务并将测试结果合并在一起?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!