Class: ParallelTests::Grouper
- Inherits:
-
Object
- Object
- ParallelTests::Grouper
- Defined in:
- lib/parallel_tests/grouper.rb
Class Method Summary collapse
- .by_scenarios(tests, num_groups, options = {}) ⇒ Object
- .by_steps(tests, num_groups, options) ⇒ Object
- .in_even_groups_by_size(items, num_groups, options = {}) ⇒ Object
Class Method Details
.by_scenarios(tests, num_groups, options = {}) ⇒ Object
9 10 11 12 |
# File 'lib/parallel_tests/grouper.rb', line 9 def by_scenarios(tests, num_groups, ={}) scenarios = group_by_scenarios(tests, ) in_even_groups_by_size(scenarios, num_groups) end |
.by_steps(tests, num_groups, options) ⇒ Object
4 5 6 7 |
# File 'lib/parallel_tests/grouper.rb', line 4 def by_steps(tests, num_groups, ) features_with_steps = build_features_with_steps(tests, ) in_even_groups_by_size(features_with_steps, num_groups) end |
.in_even_groups_by_size(items, num_groups, options = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/parallel_tests/grouper.rb', line 14 def in_even_groups_by_size(items, num_groups, = {}) groups = Array.new(num_groups) { {:items => [], :size => 0} } # add all files that should run in a single process to one group ([:single_process] || []).each do |pattern| matched, items = items.partition { |item, _size| item =~ pattern } matched.each { |item, size| add_to_group(groups.first, item, size) } end groups_to_fill = ([:isolate] ? groups[1..-1] : groups) group_features_by_size(items_to_group(items), groups_to_fill) groups.map! { |g| g[:items].sort } end |