noosfero | rake test: summarize tasks at the end

Antonio Terceiro gitlab at gitlab.com
Wed Feb 25 14:24:06 BRT 2015


Antonio Terceiro pushed to refs/heads/master at <a href="https://gitlab.com/noosfero/noosfero">Noosfero / noosfero</a>

Commits:
<a href="https://gitlab.com/noosfero/noosfero/commit/dcc12e37c6767d6d5c44040d3d9d620f7b64292f">dcc12e37</a> by Antonio Terceiro
rake test: summarize tasks at the end

- - - - -


Changes:

=====================================
lib/tasks/test.rake
=====================================
--- a/lib/tasks/test.rake
+++ b/lib/tasks/test.rake
@@ -17,15 +17,31 @@ NoosferoTasks = %w(test:noosfero_plugins)
 AllTasks = TestTasks + CucumberTasks + NoosferoTasks
 
 task :test do
-  errors = AllTasks.collect do |task|
+  data = []
+  failed = []
+  AllTasks.each do |task|
+    t0 = Time.now.to_i
     begin
       ENV['RAILS_ENV'] = 'test'
       Rake::Task[task].invoke
-      nil
+      status = 'PASS'
     rescue => e
-      task
+      failed << task
+      status = 'FAIL'
     end
-  end.compact
-  abort "Errors running #{errors.to_sentence}!" if errors.any?
+    t1 = Time.now.to_i
+    duration = t1 - t0
+    data << { :name => task, :status => status, :duration => Time.at(duration).utc.strftime("%H:%M:%S") }
+  end
+
+  puts
+  printf "%-30s %-6s %s\n", 'Task', 'Status', 'Duration'
+  printf "%-30s %-6s %s\n", '-' * 30, '-' * 6, '--------'
+  data.each do |entry|
+    printf "%-30s %-6s %s\n", entry[:name], entry[:status], entry[:duration]
+  end
+
+  puts
+  abort "Errors running #{failed.join(', ')}!" if failed.any?
 end
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20150225/36fd4a97/attachment-0001.html>


More information about the Noosfero-dev mailing list