Class: AllureCucumber::MetadataParser
- Inherits:
-
Object
- Object
- AllureCucumber::MetadataParser
- Defined in:
- lib/allure_cucumber/models/metadata_parser.rb
Overview
Cucumber tag parser helper methods
Instance Method Summary collapse
-
#behavior_labels ⇒ Array<Allure::Label>
Get behavior labels.
-
#initialize(scenario, config) ⇒ MetadataParser
constructor
Metadata parser instance.
- #labels ⇒ Array<Allure::Label>
- #links ⇒ Array<Allure::Link>
- #parameters ⇒ Array<Allure::Parameter>
- #severity ⇒ Allure::Label
- #status_details ⇒ Hash<Symbol, Boolean>
- #tag_labels ⇒ Array<Allure::Label>
Constructor Details
#initialize(scenario, config) ⇒ MetadataParser
Metadata parser instance
10 11 12 13 |
# File 'lib/allure_cucumber/models/metadata_parser.rb', line 10 def initialize(scenario, config) @scenario = scenario @config = config end |
Instance Method Details
#behavior_labels ⇒ Array<Allure::Label>
Get behavior labels
62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/allure_cucumber/models/metadata_parser.rb', line 62 def behavior_labels epic = tag_value(:epic) || scenario.feature_folder feature = tag_value(:feature) || scenario.feature_name story = tag_value(:story) [ Allure::ResultUtils.epic_label(epic), Allure::ResultUtils.feature_label(feature), Allure::ResultUtils.story_label(story) ] end |
#labels ⇒ Array<Allure::Label>
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/allure_cucumber/models/metadata_parser.rb', line 16 def labels [ Allure::ResultUtils.framework_label("cucumber"), Allure::ResultUtils.package_label(scenario.feature_folder), Allure::ResultUtils.test_class_label(scenario.feature_file_name), Allure::ResultUtils.suite_label(scenario.feature_name), severity, *behavior_labels, *tag_labels ].select(&:value) end |
#links ⇒ Array<Allure::Link>
37 38 39 |
# File 'lib/allure_cucumber/models/metadata_parser.rb', line 37 def links tms_links + issue_links end |
#parameters ⇒ Array<Allure::Parameter>
47 48 49 |
# File 'lib/allure_cucumber/models/metadata_parser.rb', line 47 def parameters scenario.examples.map { |k, v| Allure::Parameter.new(k, v) } end |
#severity ⇒ Allure::Label
42 43 44 |
# File 'lib/allure_cucumber/models/metadata_parser.rb', line 42 def severity Allure::ResultUtils.severity_label(tag_value(:severity) || "normal") end |
#status_details ⇒ Hash<Symbol, Boolean>
52 53 54 55 56 57 58 |
# File 'lib/allure_cucumber/models/metadata_parser.rb', line 52 def status_details Allure::StatusDetails.new( flaky: .any? { |tag| tag.match?(reserved_patterns[:flaky]) }, muted: .any? { |tag| tag.match?(reserved_patterns[:muted]) }, known: .any? { |tag| tag.match?(reserved_patterns[:known]) } ) end |
#tag_labels ⇒ Array<Allure::Label>
29 30 31 32 33 |
# File 'lib/allure_cucumber/models/metadata_parser.rb', line 29 def tag_labels .reject { |tag| reserved?(tag) } .map { |tag| Allure::ResultUtils.tag_label(tag.delete_prefix("@")) } end |