parallel_calabash 0.0.5 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bbfcdf254dae2ce04a16ac134e29380063893b60
4
- data.tar.gz: cba4c0855b92d9c3edb2b95a108ee69a8bb0faaa
3
+ metadata.gz: efbbc2a68f8afdd17130f1ca786be9471178900f
4
+ data.tar.gz: 0dbf0e57b693485d8bed88144d53df1d1e06d243
5
5
  SHA512:
6
- metadata.gz: e76605cc0a097f870b93966deefacfa52809047c09e3a07462a9da11a2baf4ab0ef69edaf802dad26bc48774daebc763ec7042934d2373b8a218ee50e18b5af3
7
- data.tar.gz: d5065c95805a678c532d008c72cb37c169dc447113c8348b254b8eae948d4f493c551174301205cff9df958289f212282412cdf82f116007c8ed73b98fe2b43a
6
+ metadata.gz: b91350856d0c29d57e82a5103b3b53bfd8ed5517a219ad1cadf2bba34590b3b685de1f2b05ee832ae415ae0bb90b39c8b46810071a0c5f500072f684e84d8d65
7
+ data.tar.gz: 1c3c11ac5b97a6672db65a6cfe3d69cdeb459a54e9187c40299e2077b75e2b0eef5c87131921c7bc575ff7f1ac6903850b2cbfc956d31c589e680348d9c08f65
data/README.md CHANGED
@@ -37,11 +37,10 @@ Example: parallel_calabash -a my.apk -o 'cucumber_opts_like_tags_profile_etc_her
37
37
  -h, --help Show this message
38
38
  -v, --version Show version
39
39
  -a, --apk apk_path apk file path
40
+ -d, --distribution-tag tag divide features into groups as per occurrence of given tag
40
41
  -o, --cucumber_opts '[OPTIONS]' execute with those cucumber options
41
-
42
- -d distribution_tag, divide features into groups as per occurrence of given tag
43
- --distribution-tag
44
- --serialize-stdout Serialize stdout output show output only after process completion
42
+ --serialize-stdout Serialize stdout output, nothing will be written until everything is done
43
+ --concurrent Run tests concurrently. Each test will run once on each device.
45
44
 
46
45
  ## REPROTING
47
46
 
@@ -25,7 +25,7 @@ def parse_arguments(arguments)
25
25
  options[:apk_path] = apk_path
26
26
  end
27
27
 
28
- opts.on("-d", "--distribution-tag distribution_tag", "divide features into groups as per occurrence of given tag") do |distribution_tag|
28
+ opts.on("-d", "--distribution-tag tag", "divide features into groups as per occurrence of given tag") do |distribution_tag|
29
29
  options[:distribution_tag] = distribution_tag
30
30
  end
31
31
 
@@ -37,6 +37,10 @@ def parse_arguments(arguments)
37
37
  options[:mute_output] = mute_output
38
38
  end
39
39
 
40
+ opts.on("--concurrent", "Run tests concurrently. Each test will run once on each device") do |concurrent_opt|
41
+ options[:concurrent] = true
42
+ end
43
+
40
44
  end
41
45
 
42
46
  opt_parser.parse!(arguments)
@@ -26,10 +26,11 @@ module ParallelCalabash
26
26
 
27
27
  test_results = nil
28
28
  report_time_taken do
29
- groups = FeatureGrouper.feature_groups(options[:feature_folder], number_of_processes,options[:distribution_tag])
30
- puts "#{number_of_processes} processes for #{groups.flatten.size} features"
31
- test_results = Parallel.map(groups, :in_threads => groups.size) do |group|
32
- Runner.run_tests(group, groups.index(group), options)
29
+ groups = FeatureGrouper.feature_groups(options[:feature_folder], number_of_processes, options[:distribution_tag], options[:concurrent])
30
+ threads = groups.size
31
+
32
+ test_results = Parallel.map_with_index(groups, :in_threads => threads) do |group, index|
33
+ Runner.run_tests(group, index, options)
33
34
  end
34
35
  ResultFormatter.report_results(test_results)
35
36
  end
@@ -3,8 +3,18 @@ module ParallelCalabash
3
3
 
4
4
  class << self
5
5
 
6
- def feature_groups(feature_folder, group_size,weighing_factor = nil)
7
- weighing_factor.nil? ? feature_groups_by_feature_files(feature_folder, group_size) : feature_groups_by_weight(feature_folder, group_size,weighing_factor)
6
+ def feature_groups(feature_folder, group_size,weighing_factor = nil, concurrent = nil)
7
+ if concurrent.nil?
8
+ weighing_factor.nil? ? feature_groups_by_feature_files(feature_folder, group_size) : feature_groups_by_weight(feature_folder, group_size,weighing_factor)
9
+ else
10
+ concurrent_feature_groups(feature_folder, group_size)
11
+ end
12
+ end
13
+
14
+ def concurrent_feature_groups(feature_folder, number_of_groups)
15
+ groups = []
16
+ (0...number_of_groups).each{ groups << feature_files_in_folder(feature_folder) }
17
+ groups
8
18
  end
9
19
 
10
20
  def feature_groups_by_feature_files(feature_folder, group_size)
@@ -50,6 +60,7 @@ module ParallelCalabash
50
60
  features.each do |feature|
51
61
  feature_groups[index_of_lightest_group(feature_groups)] << feature
52
62
  end
63
+ feature_groups.reject!{|group| group.empty?}
53
64
  feature_groups.map{|group| group.map{|feature_hash| feature_hash[:feature]}}
54
65
  end
55
66
 
@@ -1,3 +1,3 @@
1
1
  module ParallelCalabash
2
- VERSION = "0.0.5"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -38,6 +38,17 @@ describe ParallelCalabash::FeatureGrouper do
38
38
  [["spec/test_data/features/aaa.feature", "spec/test_data/features/fff.feature"], ["spec/test_data/features/bbb.feature"], ["spec/test_data/features/ccc.feature"], ["spec/test_data/features/ddd.feature"], ["spec/test_data/features/eee.feature"]]
39
39
  end
40
40
 
41
+ it 'should create 1 group for concurrent 1 process' do
42
+ expect(ParallelCalabash::FeatureGrouper.feature_groups(['spec/test_data/features'], 1, nil, true)).to eq \
43
+ [["spec/test_data/features/aaa.feature", "spec/test_data/features/bbb.feature", "spec/test_data/features/ccc.feature", "spec/test_data/features/ddd.feature", "spec/test_data/features/eee.feature", "spec/test_data/features/fff.feature"]]
44
+ end
45
+
46
+ it 'should create 2 group for concurrent 2 processes' do
47
+ expect(ParallelCalabash::FeatureGrouper.feature_groups(['spec/test_data/features'], 2, nil, true)).to eq \
48
+ [["spec/test_data/features/aaa.feature", "spec/test_data/features/bbb.feature", "spec/test_data/features/ccc.feature", "spec/test_data/features/ddd.feature", "spec/test_data/features/eee.feature", "spec/test_data/features/fff.feature"],
49
+ ["spec/test_data/features/aaa.feature", "spec/test_data/features/bbb.feature", "spec/test_data/features/ccc.feature", "spec/test_data/features/ddd.feature", "spec/test_data/features/eee.feature", "spec/test_data/features/fff.feature"]]
50
+ end
51
+
41
52
  end
42
53
 
43
54
  describe :feature_weight do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parallel_calabash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rajdeep
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-11 00:00:00.000000000 Z
11
+ date: 2015-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler