Commit dda935046a73574e66cdedb1a9a2db6dba713e2c

Authored by Antonio Terceiro
1 parent 959b51a1

Improve plugin test runs

- process plugins in alphabeticall order, so when watching the console
  output, one can know at which point of the execution we are.
- run all tests of a given type (unit, functional etc) for a single
  plugin together. On my machine this brings the total run time from
  ~34min down to ~20min.
Showing 1 changed file with 4 additions and 3 deletions   Show diff stats
lib/tasks/plugins_tests.rake
1 @all_plugins = Dir.glob('plugins/*').map { |f| File.basename(f) } - ['template'] 1 @all_plugins = Dir.glob('plugins/*').map { |f| File.basename(f) } - ['template']
  2 +@all_plugins.sort!
2 @all_tasks = [:units, :functionals, :integration, :cucumber, :selenium] 3 @all_tasks = [:units, :functionals, :integration, :cucumber, :selenium]
3 4
4 def enabled_plugins 5 def enabled_plugins
@@ -110,7 +111,7 @@ def run_cucumber(profile, files) @@ -110,7 +111,7 @@ def run_cucumber(profile, files)
110 sh 'xvfb-run', 'ruby', '-S', 'cucumber', '--profile', profile.to_s, '--format', ENV['CUCUMBER_FORMAT'] || 'progress' , *files 111 sh 'xvfb-run', 'ruby', '-S', 'cucumber', '--profile', profile.to_s, '--format', ENV['CUCUMBER_FORMAT'] || 'progress' , *files
111 end 112 end
112 113
113 -def custom_run(name, files, run=:individually) 114 +def custom_run(name, files, run=:all)
114 case run 115 case run
115 when :all 116 when :all
116 run_test name, files 117 run_test name, files
@@ -122,7 +123,7 @@ def custom_run(name, files, run=:individually) @@ -122,7 +123,7 @@ def custom_run(name, files, run=:individually)
122 end 123 end
123 end 124 end
124 125
125 -def run_tests(name, plugins, run=:individually) 126 +def run_tests(name, plugins, run=:all)
126 plugins = Array(plugins) 127 plugins = Array(plugins)
127 glob = "plugins/{#{plugins.join(',')}}/test/#{task2folder(name)}/**/*.#{task2ext(name)}" 128 glob = "plugins/{#{plugins.join(',')}}/test/#{task2folder(name)}/**/*.#{task2ext(name)}"
128 files = Dir.glob(glob) 129 files = Dir.glob(glob)
@@ -169,7 +170,7 @@ def test_sequence(plugins, tasks) @@ -169,7 +170,7 @@ def test_sequence(plugins, tasks)
169 fail 'There are broken tests to be fixed!' if fail_flag 170 fail 'There are broken tests to be fixed!' if fail_flag
170 end 171 end
171 172
172 -def plugin_test_task(plugin, task, run=:individually) 173 +def plugin_test_task(plugin, task, run=:all)
173 desc "Run #{task} tests for #{plugin_name(plugin)}" 174 desc "Run #{task} tests for #{plugin_name(plugin)}"
174 task task do 175 task task do
175 test_sequence(plugin, task) 176 test_sequence(plugin, task)