Commit a7ef8536c847b8ab5640f5d0ab0674c603e7d8b8

Authored by Antonio Terceiro
1 parent cef17d54

Skip tests for plugins with broken tests

Also, add a nice plugin status report at the bottom
Showing 1 changed file with 40 additions and 2 deletions   Show diff stats
lib/tasks/plugins_tests.rake
  1 +@broken_plugins = %w[
  2 + anti_spam
  3 + bsc
  4 + comment_classification
  5 + ldap
  6 + send_email
  7 + shopping_cart
  8 + solr
  9 + tolerance_time
  10 +]
  11 +
1 12 @all_plugins = Dir.glob('plugins/*').map { |f| File.basename(f) } - ['template']
2 13 @all_plugins.sort!
3 14 @all_tasks = [:units, :functionals, :integration, :cucumber, :selenium]
... ... @@ -167,6 +178,7 @@ def test_sequence(plugins, tasks)
167 178 end
168 179 end
169 180 rollback_plugins_state
  181 + yield(failed) if block_given?
170 182 fail 'There are broken tests to be fixed!' if fail_flag
171 183 end
172 184  
... ... @@ -195,13 +207,39 @@ namespace :test do
195 207 @all_tasks.each do |taskname|
196 208 desc "Run #{taskname} tests for all plugins"
197 209 task taskname do
198   - test_sequence(@all_plugins, taskname)
  210 + test_sequence(@all_plugins - @broken_plugins, taskname)
199 211 end
200 212 end
201 213 end
202 214  
203 215 desc "Run all tests for all plugins"
204 216 task :noosfero_plugins do
205   - test_sequence(@all_plugins, @all_tasks)
  217 + test_sequence(@all_plugins - @broken_plugins, @all_tasks) do |failed|
  218 + plugins_status_report(failed)
  219 + end
206 220 end
207 221 end
  222 +
  223 +def plugins_status_report(failed)
  224 + w = @all_plugins.map { |s| s.size }.max
  225 +
  226 + puts
  227 + printf ('=' * (w + 21)) + "\n"
  228 + puts 'Plugins status report'
  229 + printf ('=' * (w + 21)) + "\n"
  230 + printf "%-#{w}s %s\n", "Plugin", "Status"
  231 + printf ('-' * w) + ' ' + ('-' * 20) + "\n"
  232 +
  233 + @all_plugins.each do |plugin|
  234 + if @broken_plugins.include?(plugin)
  235 + status = "SKIP"
  236 + elsif !failed[plugin] || failed[plugin].empty?
  237 + status = "PASS"
  238 + else
  239 + status = "FAIL: #{failed[plugin].join(', ')}"
  240 + end
  241 + printf "%-#{w}s %s\n", plugin, status
  242 + end
  243 + printf ('=' * (w + 21)) + "\n"
  244 + puts
  245 +end
... ...