Class: Cucumber::Runtime

Inherits:
Object show all
Includes:
Core, Formatter::Duration, UserInterface
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/runtime.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/runtime/step_hooks.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/runtime/after_hooks.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/runtime/before_hooks.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/runtime/support_code.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/runtime/user_interface.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/runtime/meta_message_builder.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/runtime/for_programming_languages.rb

Defined Under Namespace

Modules: UserInterface Classes: AfterHooks, BeforeHooks, ForProgrammingLanguages, MetaMessageBuilder, NormalisedEncodingFile, StepHooks, SupportCode

Instance Attribute Summary collapse

Attributes included from UserInterface

#visitor

Instance Method Summary collapse

Methods included from UserInterface

#ask, #attach

Methods included from Formatter::Duration

#format_duration

Methods included from Core

#compile, #execute

Constructor Details

#initialize(configuration = Configuration.default) ⇒ Runtime

Returns a new instance of Runtime.



58
59
60
61
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/runtime.rb', line 58

def initialize(configuration = Configuration.default)
  @configuration = Configuration.new(configuration)
  @support_code = SupportCode.new(self, @configuration)
end

Instance Attribute Details

#configurationObject (readonly)

Returns the value of attribute configuration.



52
53
54
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/runtime.rb', line 52

def configuration
  @configuration
end

#resultsObject (readonly)

Returns the value of attribute results.



52
53
54
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/runtime.rb', line 52

def results
  @results
end

#support_codeObject (readonly)

Returns the value of attribute support_code.



52
53
54
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/runtime.rb', line 52

def support_code
  @support_code
end

Instance Method Details

#begin_scenario(test_case) ⇒ Object



99
100
101
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/runtime.rb', line 99

def begin_scenario(test_case)
  @support_code.fire_hook(:begin_scenario, test_case)
end

#configure(new_configuration) ⇒ Object

Allows you to take an existing runtime and change its configuration



64
65
66
67
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/runtime.rb', line 64

def configure(new_configuration)
  @configuration = Configuration.new(new_configuration)
  @support_code.configure(@configuration)
end

#doc_string(string_without_triple_quotes, content_type = '', _line_offset = 0) ⇒ Object

Returns Ast::DocString for string_without_triple_quotes.



109
110
111
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/runtime.rb', line 109

def doc_string(string_without_triple_quotes, content_type = '', _line_offset = 0)
  Core::Test::DocString.new(string_without_triple_quotes, content_type)
end

#dry_run?Boolean

Returns:

  • (Boolean)


91
92
93
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/runtime.rb', line 91

def dry_run?
  @configuration.dry_run?
end

#end_scenario(_scenario) ⇒ Object



103
104
105
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/runtime.rb', line 103

def end_scenario(_scenario)
  @support_code.fire_hook(:end_scenario)
end

#failure?Boolean

Returns:

  • (Boolean)


113
114
115
116
117
118
119
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/runtime.rb', line 113

def failure?
  if @configuration.wip?
    summary_report.test_cases.total_passed > 0
  else
    !summary_report.ok?(@configuration.strict)
  end
end

#features_pathsObject



87
88
89
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/runtime.rb', line 87

def features_paths
  @configuration.paths
end

#run!Object



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/runtime.rb', line 69

def run!
  @configuration.notify :envelope, Cucumber::Messages::Envelope.new(
    meta: MetaMessageBuilder.build_meta_message
  )

  load_step_definitions
  fire_install_plugin_hook
  fire_before_all_hook unless dry_run?
  # TODO: can we remove this state?
  self.visitor = report

  receiver = Test::Runner.new(@configuration.event_bus)
  compile features, receiver, filters, @configuration.event_bus
  @configuration.notify :test_run_finished, !failure?

  fire_after_all_hook unless dry_run?
end

#unmatched_step_definitionsObject



95
96
97
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/runtime.rb', line 95

def unmatched_step_definitions
  @support_code.unmatched_step_definitions
end