Class: Cucumber::Formatter::LegacyApi::RuntimeFacade
- Inherits:
-
Object
- Object
- Cucumber::Formatter::LegacyApi::RuntimeFacade
- Defined in:
- lib/cucumber_characteristics/cucumber_2x_step_patch.rb
Defined Under Namespace
Classes: Feature
Instance Method Summary collapse
Instance Method Details
#scenario_profiles ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/cucumber_characteristics/cucumber_2x_step_patch.rb', line 34 def scenario_profiles return @scenario_profiles if @scenario_profiles feature_profiles = {} assign_steps_to_scenarios! results.scenarios.each do |scenario| # Feature id outline is the top level feature defintion # aggregating up multiple examples feature_id = feature_id(scenario) if outline_feature?(scenario) feature_profiles[feature_id] ||= { name: scenario.name, total_duration: 0, step_count: 0, examples: {} } agg_steps = aggregate_steps(scenario.steps) feature_profiles[feature_id][:total_duration] += agg_steps[:total_duration] feature_profiles[feature_id][:step_count] += agg_steps[:step_count] # First order step associations to scenario examples example_id = scenario_from(scenario.steps.first).name.match(/(Examples.*\))/).captures.first feature_profiles[feature_id][:examples][example_id] = { total_duration: 0, step_count: 0 } feature_profiles[feature_id][:examples][example_id] = aggregate_steps(scenario.steps) feature_profiles[feature_id][:examples][example_id][:status] = scenario.status.to_sym else feature_profiles[feature_id] = { name: scenario.name, total_duration: 0, step_count: 0 } feature_profiles[feature_id][:status] = scenario.status.to_sym feature_profiles[feature_id].merge!(aggregate_steps(scenario.steps)) end end # Collect up background tasks not directly attributable to # specific scenarios feature_files.each do |file| steps = background_steps_for(file) next if steps.empty? feature_id = "#{file}:0 (Background)" feature_profiles[feature_id] = { name: 'Background', total_duration: 0, step_count: 0 } feature_profiles[feature_id].merge!(aggregate_steps(steps)) feature_profiles[feature_id][:status] = steps.map(&:status).uniq.join(',') end @scenario_profiles = feature_profiles end |