Skip to content

Commit b97932b

Browse files
committed
Add allure-cucumber integration test
1 parent 4e9a76a commit b97932b

File tree

4 files changed

+27
-8
lines changed

4 files changed

+27
-8
lines changed

allure-cucumber/Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ require "rspec/core/rake_task"
44
require "rubocop/rake_task"
55

66
RSpec::Core::RakeTask.new(:test) do |t|
7-
t.rspec_opts = "--color --require spec_helper"
7+
t.rspec_opts = "--color --require spec_helper --tag ~reporter"
88
end
99

1010
RuboCop::RakeTask.new(:rubocop) do |task|

allure-cucumber/spec/integration/full_report_spec.rb

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,36 @@
44
include_context "cucumber runner"
55

66
let(:allure_cli) { Allure::Util.allure_cli }
7+
let(:results_dir) { Allure::CucumberConfig.results_directory }
78

8-
before(:all) do
9-
if File.exist?(Allure::CucumberConfig.results_directory)
10-
FileUtils.remove_dir(Allure::CucumberConfig.results_directory)
9+
before(:each) do
10+
FileUtils.remove_dir(results_dir) if File.exist?(results_dir)
11+
end
12+
13+
it "Generates allure json results files", integration: true do
14+
run_cucumber_cli("features/features/simple.feature")
15+
16+
container = File.new(Dir["#{results_dir}/*container.json"].first)
17+
result = File.new(Dir["#{results_dir}/*result.json"].first)
18+
19+
aggregate_failures "Results files should exist" do
20+
expect(File.exist?(container)).to be_truthy
21+
expect(File.exist?(result)).to be_truthy
22+
end
23+
24+
container_json = JSON.parse(File.read(container), symbolize_names: true)
25+
result_json = JSON.parse(File.read(result), symbolize_names: true)
26+
aggregate_failures "Json results should contain valid data" do
27+
expect(container_json[:name]).to eq("Add a to b")
28+
expect(result_json[:description]).to eq("Simple scenario description")
29+
expect(result_json[:steps].size).to eq(4)
1130
end
1231
end
1332

14-
it "Allure commandline generates report", integration: true do
33+
it "Allure commandline generates report", reporter: true do
1534
run_cucumber_cli("features/features")
1635

17-
expect(`#{allure_cli} generate -c #{Allure::CucumberConfig.results_directory} -o reports/allure-report`.chomp).to(
36+
expect(`#{allure_cli} generate -c #{results_dir} -o reports/allure-report`.chomp).to(
1837
eq("Report successfully generated to reports/allure-report"),
1938
)
2039
end

allure-ruby-commons/Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ require "rspec/core/rake_task"
44
require "rubocop/rake_task"
55

66
RSpec::Core::RakeTask.new(:test) do |t|
7-
t.rspec_opts = "--color --require spec_helper --tag ~integration"
7+
t.rspec_opts = "--color --require spec_helper --tag ~reporter"
88
end
99

1010
RuboCop::RakeTask.new(:rubocop) do |task|

allure-ruby-commons/spec/integration/full_report_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
lifecycle.stop_test_container
5858
end
5959

60-
it "generate valid json", integration: true do
60+
it "generate valid json", reporter: true do
6161
allure_cli = Allure::Util.allure_cli
6262
expect(`#{allure_cli} generate -c #{Allure::Config.results_directory} -o reports/allure-report`.chomp).to(
6363
eq("Report successfully generated to reports/allure-report"),

0 commit comments

Comments
 (0)