Commit dcc12e37c6767d6d5c44040d3d9d620f7b64292f
1 parent
fb48ecc5
Exists in
master
and in
29 other branches
rake test: summarize tasks at the end
Showing
1 changed file
with
21 additions
and
5 deletions
Show diff stats
lib/tasks/test.rake
... | ... | @@ -17,15 +17,31 @@ NoosferoTasks = %w(test:noosfero_plugins) |
17 | 17 | AllTasks = TestTasks + CucumberTasks + NoosferoTasks |
18 | 18 | |
19 | 19 | task :test do |
20 | - errors = AllTasks.collect do |task| | |
20 | + data = [] | |
21 | + failed = [] | |
22 | + AllTasks.each do |task| | |
23 | + t0 = Time.now.to_i | |
21 | 24 | begin |
22 | 25 | ENV['RAILS_ENV'] = 'test' |
23 | 26 | Rake::Task[task].invoke |
24 | - nil | |
27 | + status = 'PASS' | |
25 | 28 | rescue => e |
26 | - task | |
29 | + failed << task | |
30 | + status = 'FAIL' | |
27 | 31 | end |
28 | - end.compact | |
29 | - abort "Errors running #{errors.to_sentence}!" if errors.any? | |
32 | + t1 = Time.now.to_i | |
33 | + duration = t1 - t0 | |
34 | + data << { :name => task, :status => status, :duration => Time.at(duration).utc.strftime("%H:%M:%S") } | |
35 | + end | |
36 | + | |
37 | + puts | |
38 | + printf "%-30s %-6s %s\n", 'Task', 'Status', 'Duration' | |
39 | + printf "%-30s %-6s %s\n", '-' * 30, '-' * 6, '--------' | |
40 | + data.each do |entry| | |
41 | + printf "%-30s %-6s %s\n", entry[:name], entry[:status], entry[:duration] | |
42 | + end | |
43 | + | |
44 | + puts | |
45 | + abort "Errors running #{failed.join(', ')}!" if failed.any? | |
30 | 46 | end |
31 | 47 | ... | ... |