allure-cucumber 2.31.0 → 3.0.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
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9a359d618429532baa75dea4f036d0942f8b6d2ccd6b7eec65cb3a4234ff1605
|
|
4
|
+
data.tar.gz: 8e40d058639d22386fea35d5509e7727bea9e8eeafdb12add75d41c16fb772b7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dc2be339597e773e3f42715beba77c1d148358a619807cb546b5d339d0cb0bfb0a49c124f9de7b86290ffc951b50600774bc71d421ce0e73033c1d281a417157
|
|
7
|
+
data.tar.gz: a82bcfcdebdf54a32050a67bbde6b0d76d3c0b5e3fc17430b8e3ed7ca80c3abb304d7defa4fe50334d78c8cef072f0e5726466729220801b4c29d2a125babc81
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "cucumber/core"
|
|
4
|
+
require "cucumber/glue/dsl"
|
|
5
|
+
|
|
6
|
+
require_relative "test_plan_filter"
|
|
4
7
|
|
|
5
8
|
module AllureCucumber
|
|
6
9
|
# Main formatter class. Translates cucumber event to allure lifecycle
|
|
7
10
|
class CucumberFormatter
|
|
11
|
+
include Cucumber::Glue::Dsl
|
|
12
|
+
|
|
8
13
|
# @return [Hash] hook handler methods
|
|
9
14
|
HOOK_HANDLERS = {
|
|
10
15
|
"Before hook" => :start_prepare_fixture,
|
|
@@ -27,7 +32,7 @@ module AllureCucumber
|
|
|
27
32
|
@cucumber_model ||= AllureCucumberModel.new(config, allure_config)
|
|
28
33
|
|
|
29
34
|
names = Allure::TestPlan.test_names
|
|
30
|
-
config.
|
|
35
|
+
config.filters << TestPlanFilter.new(cucumber_model, names.to_set) if names&.any?
|
|
31
36
|
|
|
32
37
|
config.on_event(:test_run_started) { |event| on_test_run_started(event) }
|
|
33
38
|
config.on_event(:test_run_finished) { |event| on_test_run_finished(event) }
|
|
@@ -37,6 +42,7 @@ module AllureCucumber
|
|
|
37
42
|
config.on_event(:test_case_finished) { |event| on_test_case_finished(event) }
|
|
38
43
|
|
|
39
44
|
register_test_run_hook_finished(config)
|
|
45
|
+
register_exclusion_hook
|
|
40
46
|
end
|
|
41
47
|
|
|
42
48
|
# Clean test result directory before starting run
|
|
@@ -69,8 +75,11 @@ module AllureCucumber
|
|
|
69
75
|
# @param [Cucumber::Events::TestCaseStarted] event
|
|
70
76
|
# @return [void]
|
|
71
77
|
def on_test_case_started(event)
|
|
72
|
-
|
|
73
|
-
|
|
78
|
+
test_case = event.test_case
|
|
79
|
+
result = cucumber_model.test_result(test_case)
|
|
80
|
+
|
|
81
|
+
lifecycle.start_test_container(Allure::TestResultContainer.new(name: test_case.name))
|
|
82
|
+
lifecycle.start_test_case(result)
|
|
74
83
|
end
|
|
75
84
|
|
|
76
85
|
# Handle test step started event
|
|
@@ -114,6 +123,18 @@ module AllureCucumber
|
|
|
114
123
|
|
|
115
124
|
attr_reader :lifecycle, :cucumber_model
|
|
116
125
|
|
|
126
|
+
# Skip matched scenarios through Cucumber's public hook DSL.
|
|
127
|
+
# @return [void]
|
|
128
|
+
def register_exclusion_hook
|
|
129
|
+
return unless Allure::TestPlan.excluded_tests?
|
|
130
|
+
|
|
131
|
+
model = cucumber_model
|
|
132
|
+
Around do |scenario, run|
|
|
133
|
+
skip_this_scenario("Skipped by Allure test plan") if model.excluded?(scenario)
|
|
134
|
+
run.call
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
|
|
117
138
|
# Register global hook finished event
|
|
118
139
|
# @param [Cucumber::Configuration] config
|
|
119
140
|
# @return [void]
|
|
@@ -25,14 +25,29 @@ module AllureCucumber
|
|
|
25
25
|
description: scenario.description,
|
|
26
26
|
description_html: scenario.description,
|
|
27
27
|
history_id: scenario.id,
|
|
28
|
-
full_name: scenario.
|
|
28
|
+
full_name: scenario.full_name,
|
|
29
|
+
test_case_id: scenario.test_case_id,
|
|
29
30
|
title_path: scenario.title_path,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
status_details
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
environment: config.environment,
|
|
32
|
+
**test_result_metadata(parser)
|
|
33
|
+
).tap do |result|
|
|
34
|
+
result.status_details.muted = true if excluded_scenario?(scenario)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Match a scenario or outline against exact reported full-name selectors.
|
|
39
|
+
# @param [Cucumber::Core::Test::Case] test_case
|
|
40
|
+
# @param [Set<String>] selectors
|
|
41
|
+
# @return [Boolean]
|
|
42
|
+
def selected?(test_case, selectors)
|
|
43
|
+
selectors.include?(Scenario.new(test_case, ast_lookup).full_name)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Match a scenario or outline against the test plan's excluded identities.
|
|
47
|
+
# @param [Cucumber::Core::Test::Case, Cucumber::RunningTestCase::TestCase] test_case
|
|
48
|
+
# @return [Boolean]
|
|
49
|
+
def excluded?(test_case)
|
|
50
|
+
excluded_scenario?(Scenario.new(test_case, ast_lookup))
|
|
36
51
|
end
|
|
37
52
|
|
|
38
53
|
# Convert to allure step result
|
|
@@ -70,6 +85,23 @@ module AllureCucumber
|
|
|
70
85
|
|
|
71
86
|
attr_reader :ast_lookup, :config
|
|
72
87
|
|
|
88
|
+
# @param [Scenario] scenario
|
|
89
|
+
# @return [Boolean]
|
|
90
|
+
def excluded_scenario?(scenario)
|
|
91
|
+
Allure::TestPlan.excluded?(
|
|
92
|
+
allure_id: scenario.allure_id, selector: scenario.full_name, test_case_id: scenario.test_case_id
|
|
93
|
+
)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def test_result_metadata(parser)
|
|
97
|
+
{
|
|
98
|
+
labels: parser.labels,
|
|
99
|
+
links: parser.links,
|
|
100
|
+
parameters: parser.parameters,
|
|
101
|
+
status_details: parser.status_details
|
|
102
|
+
}
|
|
103
|
+
end
|
|
104
|
+
|
|
73
105
|
# @param [Step] step
|
|
74
106
|
# @return [Array<Allure::Attachment>]
|
|
75
107
|
def step_attachments(step)
|
|
@@ -19,6 +19,24 @@ module AllureCucumber
|
|
|
19
19
|
@id ||= Digest::MD5.hexdigest(test_case.inspect)
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
+
# Stable hashed scenario identity
|
|
23
|
+
# @return [String]
|
|
24
|
+
def test_case_id
|
|
25
|
+
@test_case_id ||= Digest::MD5.hexdigest(full_name)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Stable scenario identity
|
|
29
|
+
# @return [String]
|
|
30
|
+
def full_name
|
|
31
|
+
@full_name ||= Allure::ResultUtils.full_name(location_file, scenario.name)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Explicit Allure ID from scenario or inherited tags
|
|
35
|
+
# @return [String, nil]
|
|
36
|
+
def allure_id
|
|
37
|
+
@allure_id ||= tags.find { |tag| tag.start_with?("@allure_id:") }&.delete_prefix("@allure_id:")
|
|
38
|
+
end
|
|
39
|
+
|
|
22
40
|
# Feature name scenario belongs to
|
|
23
41
|
# @return [String]
|
|
24
42
|
def feature_name
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "cucumber/core/filter"
|
|
4
|
+
|
|
5
|
+
module AllureCucumber
|
|
6
|
+
# Select test-plan cases before hooks and execution are applied.
|
|
7
|
+
class TestPlanFilter < Cucumber::Core::Filter.new(:model, :selectors)
|
|
8
|
+
# @param [Cucumber::Core::Test::Case] test_case
|
|
9
|
+
# @return [TestPlanFilter]
|
|
10
|
+
def test_case(test_case)
|
|
11
|
+
test_case.describe_to(receiver) if model.selected?(test_case, selectors)
|
|
12
|
+
self
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: allure-cucumber
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 3.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrejs Cunskis
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - '='
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version:
|
|
18
|
+
version: 3.0.0
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - '='
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version:
|
|
25
|
+
version: 3.0.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: csv
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -52,7 +52,7 @@ dependencies:
|
|
|
52
52
|
version: 4.0.0
|
|
53
53
|
- - "<"
|
|
54
54
|
- !ruby/object:Gem::Version
|
|
55
|
-
version: '
|
|
55
|
+
version: '13'
|
|
56
56
|
type: :runtime
|
|
57
57
|
prerelease: false
|
|
58
58
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -62,7 +62,7 @@ dependencies:
|
|
|
62
62
|
version: 4.0.0
|
|
63
63
|
- - "<"
|
|
64
64
|
- !ruby/object:Gem::Version
|
|
65
|
-
version: '
|
|
65
|
+
version: '13'
|
|
66
66
|
description: Cucumber adapter to generate rich allure test reports
|
|
67
67
|
email: andrejs.cunskis@gmail.com
|
|
68
68
|
executables: []
|
|
@@ -77,6 +77,7 @@ files:
|
|
|
77
77
|
- lib/allure_cucumber/models/metadata_parser.rb
|
|
78
78
|
- lib/allure_cucumber/models/scenario.rb
|
|
79
79
|
- lib/allure_cucumber/models/step.rb
|
|
80
|
+
- lib/allure_cucumber/test_plan_filter.rb
|
|
80
81
|
homepage: https://github.com/allure-framework/allure-ruby
|
|
81
82
|
licenses:
|
|
82
83
|
- Apache-2.0
|