Class: Cucumber::Runtime

Inherits:
Object show all
Includes:
Core, Formatter::Duration, UserInterface
Defined in:
lib/cucumber/runtime.rb,
lib/cucumber/runtime/results.rb,
lib/cucumber/runtime/support_code.rb,
lib/cucumber/runtime/user_interface.rb,
lib/cucumber/runtime/for_programming_languages.rb

Defined Under Namespace

Modules: UserInterface Classes: ForProgrammingLanguages, NormalisedEncodingFile, Results, SupportCode

Instance Attribute Summary (collapse)

Attributes included from UserInterface

#visitor

Instance Method Summary (collapse)

Methods included from UserInterface

#ask, #embed, #puts

Methods included from Formatter::Duration

#format_duration

Constructor Details

- (Runtime) initialize(configuration = Configuration.default)



50
51
52
53
54
# File 'lib/cucumber/runtime.rb', line 50

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

Instance Attribute Details

- (Object) configuration (readonly)

Returns the value of attribute configuration



44
45
46
# File 'lib/cucumber/runtime.rb', line 44

def configuration
  @configuration
end

- (Object) results (readonly)

Returns the value of attribute results



44
45
46
# File 'lib/cucumber/runtime.rb', line 44

def results
  @results
end

- (Object) support_code (readonly)

Returns the value of attribute support_code



44
45
46
# File 'lib/cucumber/runtime.rb', line 44

def support_code
  @support_code
end

Instance Method Details

- (Object) begin_scenario(scenario)



111
112
113
# File 'lib/cucumber/runtime.rb', line 111

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

- (Object) configure(new_configuration)

Allows you to take an existing runtime and change its configuration



57
58
59
60
61
# File 'lib/cucumber/runtime.rb', line 57

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

- (Object) doc_string(string_without_triple_quotes, content_type = '', line_offset = 0)

Returns Ast::DocString for string_without_triple_quotes.



121
122
123
124
125
# File 'lib/cucumber/runtime.rb', line 121

def doc_string(string_without_triple_quotes, content_type='', line_offset=0)
  file, line = *caller[0].split(':')[0..1]
  location = Core::Ast::Location.new(file, line)
  Core::Ast::DocString.new(string_without_triple_quotes, content_type, location)
end

- (Boolean) dry_run?



79
80
81
# File 'lib/cucumber/runtime.rb', line 79

def dry_run?
  @configuration.dry_run?
end

- (Object) features_paths



75
76
77
# File 'lib/cucumber/runtime.rb', line 75

def features_paths
  @configuration.paths
end

- (Object) load_programming_language(language)



63
64
65
# File 'lib/cucumber/runtime.rb', line 63

def load_programming_language(language)
  @support_code.load_programming_language(language)
end

- (Object) record_result(scenario)



107
108
109
# File 'lib/cucumber/runtime.rb', line 107

def record_result(scenario)
  @results.scenario_visited(scenario)
end

- (Object) run!



67
68
69
70
71
72
73
# File 'lib/cucumber/runtime.rb', line 67

def run!
  load_step_definitions
  fire_after_configuration_hook
  self.visitor = report

  execute features, mappings, report, filters
end

- (Object) scenarios(status = nil)



87
88
89
# File 'lib/cucumber/runtime.rb', line 87

def scenarios(status = nil)
  @results.scenarios(status)
end

- (Object) snippet_text(step_keyword, step_name, multiline_arg)

:nodoc:



103
104
105
# File 'lib/cucumber/runtime.rb', line 103

def snippet_text(step_keyword, step_name, multiline_arg) #:nodoc:
  @support_code.snippet_text(::Gherkin::I18n.code_keyword_for(step_keyword), step_name, multiline_arg)
end

- (Object) step_match(step_name, name_to_report = nil)

:nodoc:



95
96
97
# File 'lib/cucumber/runtime.rb', line 95

def step_match(step_name, name_to_report=nil) #:nodoc:
  @support_code.step_match(step_name, name_to_report)
end

- (Object) step_visited(step)

:nodoc:



83
84
85
# File 'lib/cucumber/runtime.rb', line 83

def step_visited(step) #:nodoc:
  @results.step_visited(step)
end

- (Object) steps(status = nil)



91
92
93
# File 'lib/cucumber/runtime.rb', line 91

def steps(status = nil)
  @results.steps(status)
end

- (Boolean) unknown_programming_language?



115
116
117
# File 'lib/cucumber/runtime.rb', line 115

def unknown_programming_language?
  @support_code.unknown_programming_language?
end

- (Object) unmatched_step_definitions



99
100
101
# File 'lib/cucumber/runtime.rb', line 99

def unmatched_step_definitions
  @support_code.unmatched_step_definitions
end