class ParallelCucumber::Helper::Cucumber::JsonStatusFormatter
Public Class Methods
new(config)
click to toggle source
# File lib/parallel_cucumber/helper/cucumber/json_status_formatter.rb, line 9 def initialize(config) config.on_event :after_test_case, &method(:on_after_test_case) config.on_event :finished_testing, &method(:on_finished_testing) @io = ensure_io(config.out_stream) @result = {} end
Public Instance Methods
on_after_test_case(event)
click to toggle source
# File lib/parallel_cucumber/helper/cucumber/json_status_formatter.rb, line 17 def on_after_test_case(event) details = {status: event.result.to_sym} if event.result.respond_to?(:exception) details[:exception_classname] = event.result.exception.class.to_s details[:exception_message] = event.result.exception.message end details[:name] = "#{event.test_case.feature}: #{event.test_case.name}" details[:finish_time] = Time.now.to_i @result[event.test_case.location.to_s] = details end
on_finished_testing(*)
click to toggle source
# File lib/parallel_cucumber/helper/cucumber/json_status_formatter.rb, line 28 def on_finished_testing(*) @io.write(@result.to_json) end