Class: AllureCucumber::Scenario
- Inherits:
-
Object
- Object
- AllureCucumber::Scenario
- Defined in:
- lib/allure_cucumber/models/scenario.rb
Overview
Cucumber scenario wrapper class
Instance Method Summary collapse
-
#description ⇒ String
Scenario description or it’s location.
-
#examples ⇒ Hash<String, String>
Scenario outline row parameters.
-
#feature_file_name ⇒ String
Feature file name.
-
#feature_folder ⇒ String
Feature folder.
-
#feature_name ⇒ String
Feature name scenario belongs to.
-
#id ⇒ String
Unique scenario id.
-
#initialize(test_case, ast_lookup) ⇒ Scenario
constructor
A new instance of Scenario.
-
#name ⇒ String
Scenario name.
-
#tags ⇒ Array<String>
Scenario tags.
Constructor Details
#initialize(test_case, ast_lookup) ⇒ Scenario
Returns a new instance of Scenario.
10 11 12 13 14 |
# File 'lib/allure_cucumber/models/scenario.rb', line 10 def initialize(test_case, ast_lookup) @test_case = test_case @feature = ast_lookup.gherkin_document(test_case.location.file).feature @scenario_source = ast_lookup.scenario_source(test_case) end |
Instance Method Details
#description ⇒ String
Scenario description or it’s location
36 37 38 |
# File 'lib/allure_cucumber/models/scenario.rb', line 36 def description @description ||= scenario.description.empty? ? "Location - #{test_case.location}" : scenario.description.strip end |
#examples ⇒ Hash<String, String>
Scenario outline row parameters
42 43 44 |
# File 'lib/allure_cucumber/models/scenario.rb', line 42 def examples @examples ||= scenario_outline? ? outline_parameters : {} end |
#feature_file_name ⇒ String
Feature file name
54 55 56 |
# File 'lib/allure_cucumber/models/scenario.rb', line 54 def feature_file_name @feature_file_name ||= test_case.location.file.split("/").last.gsub(".feature", "") end |
#feature_folder ⇒ String
Feature folder
60 61 62 |
# File 'lib/allure_cucumber/models/scenario.rb', line 60 def feature_folder @feature_folder ||= test_case.location.file.split("/")[-2] end |
#feature_name ⇒ String
Feature name scenario belongs to
24 25 26 |
# File 'lib/allure_cucumber/models/scenario.rb', line 24 def feature_name @feature_name ||= feature.name end |
#id ⇒ String
Unique scenario id
18 19 20 |
# File 'lib/allure_cucumber/models/scenario.rb', line 18 def id @id ||= Digest::MD5.hexdigest(test_case.inspect) end |
#name ⇒ String
Scenario name
30 31 32 |
# File 'lib/allure_cucumber/models/scenario.rb', line 30 def name @name ||= scenario_outline? ? "#{scenario.name}, #{example_row}" : scenario.name end |
#tags ⇒ Array<String>
Scenario tags
48 49 50 |
# File 'lib/allure_cucumber/models/scenario.rb', line 48 def @tags ||= test_case..map(&:name) end |