Skip to content

Commit

Permalink
added empty steps to each of the test data feature files to work arou…
Browse files Browse the repository at this point in the history
…nd outstanding cucumber issue: cucumber/cucumber-ruby#967; fixed scenario grouping tests
  • Loading branch information
rooZzz committed Jul 17, 2016
1 parent 456b496 commit 4d31733
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 28 deletions.
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ gemspec
gem 'rake'
gem 'calabash-android'
gem 'pry'
gem 'rspec'
gem 'rspec'
gem 'minitest', '~> 4.7.5'
1 change: 0 additions & 1 deletion spec/lib/parallel_calabash/adb_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require 'spec_helper'
require 'minitest/mock'
require 'parallel_calabash/adb_helper'
describe ParallelCalabash::AdbHelper do

Expand Down
54 changes: 34 additions & 20 deletions spec/lib/parallel_calabash/feature_grouper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,37 +19,37 @@
describe :feature_groups do

it 'should group all features in only one group' do
expect(ParallelCalabash::FeatureGrouper.feature_groups({:feature_folder =>['spec/test_data/features'],:concurrent=>nil}, 1)).to eq \
expect(ParallelCalabash::FeatureGrouper.feature_groups({:feature_folder => ['spec/test_data/features'], :concurrent => nil}, 1)).to eq \
[["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"]]
end

it 'should divide features in 2 groups' do
expect(ParallelCalabash::FeatureGrouper.feature_groups({:feature_folder =>['spec/test_data/features'],:concurrent=>nil}, 2)).to eq \
expect(ParallelCalabash::FeatureGrouper.feature_groups({:feature_folder => ['spec/test_data/features'], :concurrent => nil}, 2)).to eq \
[["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"]]
end

it 'should divide features in 3 groups' do
expect(ParallelCalabash::FeatureGrouper.feature_groups({:feature_folder =>['spec/test_data/features'],:concurrent=>nil}, 3)).to eq \
expect(ParallelCalabash::FeatureGrouper.feature_groups({:feature_folder => ['spec/test_data/features'], :concurrent => nil}, 3)).to eq \
[["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"]]
end

it 'should divide features in 4 groups' do
expect(ParallelCalabash::FeatureGrouper.feature_groups({:feature_folder =>['spec/test_data/features'],:concurrent=>nil}, 4)).to eq \
expect(ParallelCalabash::FeatureGrouper.feature_groups({:feature_folder => ['spec/test_data/features'], :concurrent => nil}, 4)).to eq \
[["spec/test_data/features/aaa.feature", "spec/test_data/features/eee.feature"], ["spec/test_data/features/bbb.feature", "spec/test_data/features/fff.feature"], ["spec/test_data/features/ccc.feature"], ["spec/test_data/features/ddd.feature"]]
end

it 'should divide features in 5 groups' do
expect(ParallelCalabash::FeatureGrouper.feature_groups({:feature_folder =>['spec/test_data/features'],:concurrent=>nil}, 5)).to eq \
expect(ParallelCalabash::FeatureGrouper.feature_groups({:feature_folder => ['spec/test_data/features'], :concurrent => nil}, 5)).to eq \
[["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"]]
end

it 'should create 1 group for concurrent 1 process' do
expect(ParallelCalabash::FeatureGrouper.feature_groups({:feature_folder =>['spec/test_data/features'],:concurrent=>true}, 1)).to eq \
expect(ParallelCalabash::FeatureGrouper.feature_groups({:feature_folder => ['spec/test_data/features'], :concurrent => true}, 1)).to eq \
[["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"]]
end

it 'should create 2 group for concurrent 2 processes' do
expect(ParallelCalabash::FeatureGrouper.feature_groups({:feature_folder =>['spec/test_data/features'],:concurrent=>true}, 2)).to eq \
expect(ParallelCalabash::FeatureGrouper.feature_groups({:feature_folder => ['spec/test_data/features'], :concurrent => true}, 2)).to eq \
[["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"],
["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"]]
end
Expand Down Expand Up @@ -108,21 +108,35 @@

describe :scenario_groups do
it 'should groups all @runnable scenario equally into 2 groups' do
expect(ParallelCalabash::FeatureGrouper.scenario_groups(2,{:feature_folder => ["spec/test_data/features"],:cucumber_options => "--tags @runnable"})).to eq \
[["spec/test_data/features/aaa.feature:10", "spec/test_data/features/aaa.feature:16", "spec/test_data/features/aaa.feature:19", "spec/test_data/features/bbb.feature:13"], ["spec/test_data/features/bbb.feature:16", "spec/test_data/features/ccc.feature:11", "spec/test_data/features/ddd.feature:7", "spec/test_data/features/ddd.feature:10"]]
end

it 'should groups all @runnable scenario equally into 2 groups' do
expect(ParallelCalabash::FeatureGrouper.scenario_groups(3,{:feature_folder => ["spec/test_data/features"],:cucumber_options => "--tags @runnable"})).to eq \
[["spec/test_data/features/aaa.feature:10", "spec/test_data/features/aaa.feature:16", "spec/test_data/features/ddd.feature:7"], ["spec/test_data/features/aaa.feature:19", "spec/test_data/features/bbb.feature:13", "spec/test_data/features/ddd.feature:10"], ["spec/test_data/features/bbb.feature:16", "spec/test_data/features/ccc.feature:11"]]
end

it 'should groups all @runnable scenario equally into 2 groups' do
expect(ParallelCalabash::FeatureGrouper.scenario_groups(4,{:feature_folder => ["spec/test_data/features"],:cucumber_options => "--tags @runnable"})).to eq \
[["spec/test_data/features/aaa.feature:10", "spec/test_data/features/aaa.feature:16"], ["spec/test_data/features/aaa.feature:19", "spec/test_data/features/bbb.feature:13"], ["spec/test_data/features/bbb.feature:16", "spec/test_data/features/ccc.feature:11"], ["spec/test_data/features/ddd.feature:7", "spec/test_data/features/ddd.feature:10"]]
expected = [
['spec/test_data/features/aaa.feature:12', 'spec/test_data/features/aaa.feature:20', 'spec/test_data/features/aaa.feature:24', 'spec/test_data/features/bbb.feature:16'],
['spec/test_data/features/bbb.feature:20', 'spec/test_data/features/ccc.feature:12', 'spec/test_data/features/ddd.feature:8', 'spec/test_data/features/ddd.feature:12']
]
actual = ParallelCalabash::FeatureGrouper.scenario_groups(2, {:feature_folder => ['spec/test_data/features'], :cucumber_options => '--tags @runnable'})
expect(actual).to eq(expected)
end

it 'should groups all @runnable scenario equally into 3 groups' do
expected = [
['spec/test_data/features/aaa.feature:12', 'spec/test_data/features/aaa.feature:20', 'spec/test_data/features/ddd.feature:8'],
['spec/test_data/features/aaa.feature:24', 'spec/test_data/features/bbb.feature:16', 'spec/test_data/features/ddd.feature:12'],
['spec/test_data/features/bbb.feature:20', 'spec/test_data/features/ccc.feature:12']
]
actual = ParallelCalabash::FeatureGrouper.scenario_groups(3, {:feature_folder => ['spec/test_data/features'], :cucumber_options => '--tags @runnable'})
expect(actual).to eq(expected)
end

it 'should groups all @runnable scenario equally into 4 groups' do
actual = ParallelCalabash::FeatureGrouper.scenario_groups(4, {:feature_folder => ['spec/test_data/features'], :cucumber_options => '--tags @runnable'})
expected = [
['spec/test_data/features/aaa.feature:12', 'spec/test_data/features/aaa.feature:20'],
['spec/test_data/features/aaa.feature:24', 'spec/test_data/features/bbb.feature:16'],
['spec/test_data/features/bbb.feature:20', 'spec/test_data/features/ccc.feature:12'],
['spec/test_data/features/ddd.feature:8', 'spec/test_data/features/ddd.feature:12']
]
expect(actual).to eq(expected)
end

end


end
16 changes: 15 additions & 1 deletion spec/test_data/features/aaa.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,56 @@ Feature: aaa feature

@tag1
Scenario:
Given empty step

@tag1
Scenario:
Given empty step

@tag1 @runnable
Scenario:
Given empty step

@tag1
Scenario:
Given empty step

@tag1 @runnable
Scenario:
Given empty step

@tag1 @runnable
Scenario:
Given empty step

@tag1
Scenario:
Given empty step

@tag1
Scenario:
Given empty step

@tag1
Scenario:
Given empty step

@tag1
Scenario:
Given empty step

@tag1
Scenario:
Given empty step

@tag1
Scenario:
Given empty step

@tag1
Scenario:
Given empty step

@tag1
Scenario:
Scenario:
Given empty step
8 changes: 7 additions & 1 deletion spec/test_data/features/bbb.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,24 @@ Feature: bbb.feature

@tag1
Scenario:
Given empty step

@tag1
Scenario:
Given empty step

@tag12
Scenario:
Given empty step

@tag1 @runnable
Scenario:
Given empty step

@tag1 @runnable
Scenario:
Given empty step

@tag1
Scenario:
Scenario:
Given empty step
7 changes: 5 additions & 2 deletions spec/test_data/features/ccc.feature
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
Feature: ccc.feature


@tag1
Scenario:
Given empty step

@tag1
Scenario:
Given empty step

@tag1 @runnable
Scenario:
Given empty step

@tag1
Scenario:
Scenario:
Given empty step
5 changes: 4 additions & 1 deletion spec/test_data/features/ddd.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ Feature: ddd.feature

@tag1
Scenario:
Given empty step

@tag1 @runnable
Scenario:
Given empty step

@tag1 @runnable
Scenario:
Scenario:
Given empty step
4 changes: 3 additions & 1 deletion spec/test_data/features/eee.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ Feature: eee feature

@tag1
Scenario:
Given empty step

@tag1
Scenario:
Scenario:
Given empty step

0 comments on commit 4d31733

Please sign in to comment.