Class: Cucumber::Formatter::LegacyApi::Adapter::FeaturePrinter
- Defined in:
- lib/cucumber/formatter/legacy_api/adapter.rb
Instance Attribute Summary collapse
-
#current_test_step_source ⇒ Object
readonly
Returns the value of attribute current_test_step_source.
Instance Method Summary collapse
- #after ⇒ Object
- #after_hook(location, result) ⇒ Object
- #after_step_hook(hook, result) ⇒ Object
- #after_test_case(test_case, test_case_result) ⇒ Object
- #after_test_step(test_step, result) ⇒ Object
- #background(node) ⇒ Object
- #before ⇒ Object
- #before_hook(location, result) ⇒ Object
- #before_test_case(test_case) ⇒ Object
- #before_test_step(test_step) ⇒ Object
- #embed(src, mime_type, label) ⇒ Object
- #examples_table ⇒ Object
- #examples_table_row ⇒ Object
- #feature ⇒ Object
- #puts(messages) ⇒ Object
- #scenario ⇒ Object
- #scenario_outline ⇒ Object
- #step ⇒ Object
Instance Attribute Details
#current_test_step_source ⇒ Object (readonly)
Returns the value of attribute current_test_step_source.
225 226 227 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 225 def current_test_step_source @current_test_step_source end |
Instance Method Details
#after ⇒ Object
308 309 310 311 312 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 308 def after @child.after if @child formatter.after_feature(node) self end |
#after_hook(location, result) ⇒ Object
271 272 273 274 275 276 277 278 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 271 def after_hook(location, result) # if the scenario has no steps, we can hit this before we've created the scenario printer # ideally we should call switch_step_container in before_step_step switch_step_container if !@child @child.after_hook Ast::HookResult.new(LegacyResultBuilder.new(result), @delayed_messages, @delayed_embeddings) @delayed_messages = [] @delayed_embeddings = [] end |
#after_step_hook(hook, result) ⇒ Object
280 281 282 283 284 285 286 287 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 280 def after_step_hook(hook, result) p current_test_step_source if current_test_step_source.step.nil? line = current_test_step_source.step.backtrace_line @child.after_step_hook Ast::HookResult.new(LegacyResultBuilder.new(result). append_to_exception_backtrace(line), @delayed_messages, @delayed_embeddings) @delayed_messages = [] @delayed_embeddings = [] end |
#after_test_case(test_case, test_case_result) ⇒ Object
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 243 def after_test_case(test_case, test_case_result) if current_test_step_source && current_test_step_source.step_result.nil? switch_step_container end if test_case_result.failed? && !any_test_steps_failed? # around hook must have failed. Print the error. switch_step_container(TestCaseSource.for(test_case, test_case_result)) LegacyResultBuilder.new(test_case_result).describe_exception_to formatter end # messages and embedding should already have been handled, but just in case... @delayed_messages.each { || formatter.puts() } @delayed_embeddings.each { || .send_to_formatter(formatter) } @delayed_messages = [] @delayed_embeddings = [] @child.after_test_case(test_case, test_case_result) if @child @previous_test_case_background = @current_test_case_background @previous_test_case_scenario_outline = current_test_step_source && current_test_step_source.scenario_outline end |
#after_test_step(test_step, result) ⇒ Object
235 236 237 238 239 240 241 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 235 def after_test_step(test_step, result) @current_test_step_source = TestStepSource.for(test_step, result) # TODO: stop calling self, and describe source to another object test_step.describe_source_to(self, result) print_step @test_step_results << result end |
#background(node) ⇒ Object
289 290 291 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 289 def background(node, *) @current_test_case_background = node end |
#before ⇒ Object
214 215 216 217 218 219 220 221 222 223 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 214 def before formatter.before_feature(node) language_comment = node.language.iso_code != 'en' ? ["# language: #{node.language.iso_code}"] : [] Ast::Comments.new(language_comment + node.comments).accept(formatter) Ast::Tags.new(node.).accept(formatter) formatter.feature_name node.keyword, node.legacy_conflated_name_and_description @delayed_messages = [] @delayed_embeddings = [] self end |
#before_hook(location, result) ⇒ Object
265 266 267 268 269 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 265 def before_hook(location, result) @before_hook_results << Ast::HookResult.new(LegacyResultBuilder.new(result), @delayed_messages, @delayed_embeddings) @delayed_messages = [] @delayed_embeddings = [] end |
#before_test_case(test_case) ⇒ Object
227 228 229 230 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 227 def before_test_case(test_case) @before_hook_results = Ast::HookResultCollection.new @test_step_results = [] end |
#before_test_step(test_step) ⇒ Object
232 233 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 232 def before_test_step(test_step) end |
#embed(src, mime_type, label) ⇒ Object
297 298 299 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 297 def (src, mime_type, label) @delayed_embeddings.push Embedding.new(src, mime_type, label) end |
#examples_table ⇒ Object
304 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 304 def examples_table(*);end |
#examples_table_row ⇒ Object
305 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 305 def examples_table_row(*);end |
#feature ⇒ Object
306 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 306 def feature(*);end |
#puts(messages) ⇒ Object
293 294 295 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 293 def puts() @delayed_messages.push * end |
#scenario ⇒ Object
302 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 302 def scenario(*);end |
#scenario_outline ⇒ Object
303 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 303 def scenario_outline(*);end |
#step ⇒ Object
301 |
# File 'lib/cucumber/formatter/legacy_api/adapter.rb', line 301 def step(*);end |