-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3aa4f42
commit f3075bd
Showing
15 changed files
with
384 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,4 @@ | |
/vendor | ||
/coverage | ||
config/cucumber.yml | ||
/feature | ||
/features |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,4 @@ | ||
default: --format pretty --profile semaphoreci --profile semaphoreci --profile semaphoreci --profile semaphoreci --profile semaphoreci --profile semaphoreci --profile semaphoreci --profile semaphoreci --profile semaphoreci --profile semaphoreci --profile semaphoreci --profile semaphoreci --profile semaphoreci --profile semaphoreci --profile semaphoreci --profile semaphoreci | ||
semaphoreci: --format json --out=../cucumber_report.json | ||
semaphoreci: --format json --out=../cucumber_report.json | ||
semaphoreci: --format json --out=../cucumber_report.json | ||
semaphoreci: --format json --out=../cucumber_report.json | ||
semaphoreci: --format json --out=../cucumber_report.json | ||
semaphoreci: --format json --out=../cucumber_report.json | ||
semaphoreci: --format json --out=../cucumber_report.json | ||
semaphoreci: --format json --out=../cucumber_report.json | ||
semaphoreci: --format json --out=../cucumber_report.json | ||
semaphoreci: --format json --out=../cucumber_report.json | ||
semaphoreci: --format json --out=../cucumber_report.json | ||
semaphoreci: --format json --out=../cucumber_report.json | ||
semaphoreci: --format json --out=../cucumber_report.json | ||
default: --format pretty --profile semaphoreci --profile semaphoreci --profile semaphoreci | ||
semaphoreci: --format json --out=../cucumber_report.json | ||
semaphoreci: --format json --out=../cucumber_report.json | ||
semaphoreci: --format json --out=../cucumber_report.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
spec/integration/cucumber_booster/empty_split_configuration_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
require "spec_helper" | ||
|
||
describe "Cucumber Booster behaviour when split configuration is empty" do | ||
|
||
let(:specs_path) { "features" } | ||
let(:split_configuration_path) { "/tmp/cucumber_split_configuration.json" } | ||
let(:cucumber_report_path) { "cucumber_report.json" } | ||
|
||
before do | ||
# Set up environment variables | ||
ENV["SPEC_PATH"] = specs_path | ||
ENV["CUCUMBER_SPLIT_CONFIGURATION_PATH"] = split_configuration_path | ||
ENV["REPORT_PATH"] = cucumber_report_path | ||
|
||
# Set up test dir structure | ||
FileUtils.rm_rf(specs_path) | ||
FileUtils.mkdir_p(specs_path) | ||
FileUtils.rm_f(cucumber_report_path) | ||
|
||
# Create spec files | ||
Support::CucumberFilesFactory.create(:name => "A", :path => "#{specs_path}/a.feature") | ||
Support::CucumberFilesFactory.create(:name => "B", :path => "#{specs_path}/b.feature") | ||
Support::CucumberFilesFactory.create(:name => "C", :path => "#{specs_path}/admin/c.feature") | ||
|
||
# Construct empty split configuration | ||
File.write(split_configuration_path, [{ :files => [] }, { :files => [] }, { :files => [] }].to_json) | ||
|
||
# make sure that everything is set up as it should be | ||
expect(File.exist?(cucumber_report_path)).to eq(false) | ||
|
||
expect(File.exist?(split_configuration_path)).to eq(true) | ||
|
||
expect(Dir["#{specs_path}/**/*"].sort).to eq([ | ||
"#{specs_path}/a.feature", | ||
"#{specs_path}/admin", | ||
"#{specs_path}/admin/c.feature", | ||
"#{specs_path}/b.feature", | ||
"#{specs_path}/step_definitions", | ||
"#{specs_path}/step_definitions/a_step.rb", | ||
"#{specs_path}/step_definitions/b_step.rb", | ||
"#{specs_path}/step_definitions/c_step.rb" | ||
]) | ||
end | ||
|
||
specify "first thread's behaviour" do | ||
output = `cucumber_booster --thread 1` | ||
|
||
puts output | ||
|
||
expect(output).to include("1 scenario (1 passed)") | ||
expect($?.exitstatus).to eq(0) | ||
|
||
expect(File.exist?(cucumber_report_path)).to eq(true) | ||
end | ||
|
||
specify "second thread's behaviour" do | ||
output = `cucumber_booster --thread 2` | ||
|
||
expect(output).to include("1 example, 1 failure") | ||
expect($?.exitstatus).to eq(1) | ||
|
||
expect(File.exist?(rspec_report_path)).to eq(true) | ||
end | ||
|
||
specify "third thread's behaviour" do | ||
output = `cucumber_booster --thread 3` | ||
|
||
expect(output).to include("1 example, 0 failure") | ||
expect($?.exitstatus).to eq(0) | ||
|
||
expect(File.exist?(rspec_report_path)).to eq(true) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
require "spec_helper" | ||
|
||
describe "RSpec Booster behvaviour when the tests fail" do | ||
|
||
let(:project_path) { "/tmp/project_path-#{SecureRandom.uuid}" } | ||
let(:specs_path) { "#{project_path}/spec" } | ||
let(:split_configuration_path) { "/tmp/rspec_split_configuration.json" } | ||
let(:rspec_report_path) { "/tmp/rspec_report.json" } | ||
|
||
before do | ||
# Set up environment variables | ||
ENV["SPEC_PATH"] = specs_path | ||
ENV["RSPEC_SPLIT_CONFIGURATION_PATH"] = split_configuration_path | ||
ENV["REPORT_PATH"] = rspec_report_path | ||
|
||
# Set up test dir structure | ||
FileUtils.rm_rf(specs_path) | ||
FileUtils.mkdir_p(specs_path) | ||
FileUtils.rm_f(rspec_report_path) | ||
|
||
# Create spec files | ||
Support::RspecFilesFactory.create(:path => "#{specs_path}/a_spec.rb", :result => :failing) | ||
Support::RspecFilesFactory.create(:path => "#{specs_path}/b_spec.rb", :result => :failing) | ||
Support::RspecFilesFactory.create(:path => "#{specs_path}/lib/c_spec.rb", :result => :passing) | ||
|
||
# Construct spec helper file | ||
File.write("#{specs_path}/spec_helper.rb", "") | ||
|
||
# Construct a split configuration | ||
File.write(split_configuration_path, [ | ||
{ :files => ["#{specs_path}/a_spec.rb"] }, | ||
{ :files => ["#{specs_path}/b_spec.rb"] }, | ||
{ :files => [] } | ||
].to_json) | ||
|
||
# make sure that everything is set up as it should be | ||
expect(File.exist?(rspec_report_path)).to eq(false) | ||
|
||
expect(File.exist?(split_configuration_path)).to eq(true) | ||
|
||
expect(Dir["#{specs_path}/**/*"].sort).to eq([ | ||
"#{specs_path}/a_spec.rb", | ||
"#{specs_path}/b_spec.rb", | ||
"#{specs_path}/lib", | ||
"#{specs_path}/lib/c_spec.rb", | ||
"#{specs_path}/spec_helper.rb" | ||
]) | ||
end | ||
|
||
specify "first thread's behaviour" do | ||
output = `cd #{project_path} && rspec_booster --thread 1` | ||
|
||
expect(output).to include("2 examples, 1 failure") | ||
expect($?.exitstatus).to eq(1) | ||
|
||
expect(File.exist?(rspec_report_path)).to eq(true) | ||
end | ||
|
||
specify "second thread's behaviour" do | ||
output = `cd #{project_path} && rspec_booster --thread 2` | ||
|
||
expect(output).to include("1 example, 1 failure") | ||
expect($?.exitstatus).to eq(1) | ||
|
||
expect(File.exist?(rspec_report_path)).to eq(true) | ||
end | ||
|
||
specify "third thread's behaviour" do | ||
output = `cd #{project_path} && rspec_booster --thread 3` | ||
|
||
expect(output).to include("No files to run in this thread!") | ||
expect($?.exitstatus).to eq(0) | ||
|
||
expect(File.exist?(rspec_report_path)).to eq(false) | ||
end | ||
|
||
end |
73 changes: 73 additions & 0 deletions
73
spec/integration/cucumber_booster/malformed_split_configuration_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
require "spec_helper" | ||
|
||
describe "RSpec Booster behvaviour when split configuration is malformed" do | ||
|
||
let(:project_path) { "/tmp/project_path-#{SecureRandom.uuid}" } | ||
let(:specs_path) { "#{project_path}/spec" } | ||
let(:split_configuration_path) { "/tmp/rspec_split_configuration.json" } | ||
let(:rspec_report_path) { "/tmp/rspec_report.json" } | ||
|
||
before do | ||
# Set up environment variables | ||
ENV["SPEC_PATH"] = specs_path | ||
ENV["RSPEC_SPLIT_CONFIGURATION_PATH"] = split_configuration_path | ||
ENV["REPORT_PATH"] = rspec_report_path | ||
|
||
# Set up test dir structure | ||
FileUtils.rm_rf(specs_path) | ||
FileUtils.mkdir_p(specs_path) | ||
FileUtils.rm_f(rspec_report_path) | ||
|
||
# Create spec files | ||
Support::RspecFilesFactory.create(:path => "#{specs_path}/a_spec.rb", :result => :passing) | ||
Support::RspecFilesFactory.create(:path => "#{specs_path}/b_spec.rb", :result => :passing) | ||
Support::RspecFilesFactory.create(:path => "#{specs_path}/lib/c_spec.rb", :result => :passing) | ||
|
||
# Construct spec helper file | ||
File.write("#{specs_path}/spec_helper.rb", "") | ||
|
||
# Construct a broken split configuration | ||
File.write(split_configuration_path, { :lol => "Batman is stronger than Superman" }.to_json) | ||
|
||
# make sure that everything is set up as it should be | ||
expect(File.exist?(rspec_report_path)).to eq(false) | ||
|
||
expect(File.exist?(split_configuration_path)).to eq(true) | ||
|
||
expect(Dir["#{specs_path}/**/*"].sort).to eq([ | ||
"#{specs_path}/a_spec.rb", | ||
"#{specs_path}/b_spec.rb", | ||
"#{specs_path}/lib", | ||
"#{specs_path}/lib/c_spec.rb", | ||
"#{specs_path}/spec_helper.rb" | ||
]) | ||
end | ||
|
||
specify "first thread's behaviour" do | ||
output = `cd #{project_path} && rspec_booster --thread 1` | ||
|
||
expect(output).to include("[ERROR] The split configuration file is malformed!") | ||
expect($?.exitstatus).to eq(1) | ||
|
||
expect(File.exist?(rspec_report_path)).to eq(false) | ||
end | ||
|
||
specify "second thread's behaviour" do | ||
output = `cd #{project_path} && rspec_booster --thread 2` | ||
|
||
expect(output).to include("[ERROR] The split configuration file is malformed!") | ||
expect($?.exitstatus).to eq(1) | ||
|
||
expect(File.exist?(rspec_report_path)).to eq(false) | ||
end | ||
|
||
specify "third thread's behaviour" do | ||
output = `cd #{project_path} && rspec_booster --thread 3` | ||
|
||
expect(output).to include("[ERROR] The split configuration file is malformed!") | ||
expect($?.exitstatus).to eq(1) | ||
|
||
expect(File.exist?(rspec_report_path)).to eq(false) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
require "spec_helper" | ||
|
||
describe "RSpec Booster behvaviour there are no spec files" do | ||
|
||
let(:project_path) { "/tmp/project_path-#{SecureRandom.uuid}" } | ||
let(:specs_path) { "#{project_path}/spec" } | ||
let(:split_configuration_path) { "/tmp/rspec_split_configuration.json" } | ||
let(:rspec_report_path) { "/tmp/rspec_report.json" } | ||
|
||
before do | ||
# Set up environment variables | ||
ENV["SPEC_PATH"] = specs_path | ||
ENV["RSPEC_SPLIT_CONFIGURATION_PATH"] = split_configuration_path | ||
ENV["REPORT_PATH"] = rspec_report_path | ||
|
||
# Set up test dir structure | ||
FileUtils.rm_rf(specs_path) | ||
FileUtils.mkdir_p(specs_path) | ||
FileUtils.rm_f(rspec_report_path) | ||
|
||
# Construct a split configuration | ||
File.write(split_configuration_path, [ | ||
{ :files => ["#{specs_path}/a_spec.rb"] }, | ||
{ :files => ["#{specs_path}/b_spec.rb"] }, | ||
{ :files => [] } | ||
].to_json) | ||
|
||
# make sure that everything is set up as it should be | ||
expect(File.exist?(rspec_report_path)).to eq(false) | ||
|
||
expect(File.exist?(split_configuration_path)).to eq(true) | ||
|
||
expect(Dir["#{specs_path}/**/*"].sort).to eq([]) | ||
end | ||
|
||
specify "first thread's behaviour" do | ||
output = `cd #{project_path} && rspec_booster --thread 1` | ||
|
||
expect($?.exitstatus).to eq(0) | ||
expect(output).to include("No files to run in this thread!") | ||
|
||
expect(File.exist?(rspec_report_path)).to eq(false) | ||
end | ||
|
||
specify "second thread's behaviour" do | ||
output = `cd #{project_path} && rspec_booster --thread 2` | ||
|
||
expect($?.exitstatus).to eq(0) | ||
expect(output).to include("No files to run in this thread!") | ||
|
||
expect(File.exist?(rspec_report_path)).to eq(false) | ||
end | ||
|
||
specify "third thread's behaviour" do | ||
output = `cd #{project_path} && rspec_booster --thread 3` | ||
|
||
expect($?.exitstatus).to eq(0) | ||
expect(output).to include("No files to run in this thread!") | ||
|
||
expect(File.exist?(rspec_report_path)).to eq(false) | ||
end | ||
|
||
end |
12 changes: 12 additions & 0 deletions
12
spec/integration/cucumber_booster/no_split_configuration_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require "spec_helper" | ||
|
||
describe "RSpec Booster behvaviour when there is no split configuration" do | ||
|
||
before do | ||
ENV["SPEC_PATH"] = "fixtures/green_rspec_project/spec" | ||
end | ||
|
||
it "runs specs based on leftover files colculation" do | ||
end | ||
|
||
end |
Oops, something went wrong.