Class: QAT::Formatter::Console
- Inherits:
-
Object
- Object
- QAT::Formatter::Console
- Includes:
- Cucumber::Formatter::Io, Cucumber::Gherkin::Formatter::Escaping, FileUtils, Loggable, Logger
- Defined in:
- lib/qat/formatter/console.rb
Overview
Formatter to print Feature, Scenario and Step information on the fly. Will use STDOUT by default or a specified logger configuration channel.
Instance Method Summary collapse
- #after_feature(*_) ⇒ Object private
- #after_test_case(step, result) ⇒ Object private
- #before_test_case(test_case) ⇒ Object private
- #before_test_step(step) ⇒ Object private
-
#initialize(_, path_or_io, options) ⇒ Console
constructor
private
A new instance of Console.
- #puts(obj) ⇒ Object private
Methods included from Loggable
#begin_test_step, #check_outputter, #ensure_outputter
Methods included from Loggable::Mdc
#mdc_add_status_failed!, #mdc_add_step!, #mdc_after_feature!, #mdc_before_feature!, #mdc_before_scenario!, #mdc_remove_step!, #mdc_reset_scenario!
Constructor Details
#initialize(_, path_or_io, options) ⇒ Console
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Console.
22 23 24 25 26 |
# File 'lib/qat/formatter/console.rb', line 22 def initialize(_, path_or_io, ) @options = check_outputter path_or_io unless [:dry_run] end |
Instance Method Details
#after_feature(*_) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
42 43 44 45 46 47 48 |
# File 'lib/qat/formatter/console.rb', line 42 def after_feature *_ return if @options[:dry_run] log.info { "Finished #{@current_feature.keyword}: \"#{@current_feature.name}\"" } @current_feature = nil mdc_after_feature! end |
#after_test_case(step, result) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
51 52 53 54 55 56 57 |
# File 'lib/qat/formatter/console.rb', line 51 def after_test_case step, result return if @options[:dry_run] log.error { result.exception } if result.failed? log.info { "Finished #{@current_scenario.keyword}: \"#{format_scenario_name step}\" - #{result.to_sym}\n" } if @current_scenario end |
#before_test_case(test_case) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/qat/formatter/console.rb', line 29 def before_test_case test_case return if @options[:dry_run] unless @current_feature @current_feature = test_case.source[0] log.info { "Running #{@current_feature.keyword}: \"#{@current_feature.name}\"" } mdc_before_feature! @current_feature.name end @current_scenario = test_case.source[1] end |
#before_test_step(step) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/qat/formatter/console.rb', line 60 def before_test_step step return if @options[:dry_run] begin_test_step step do |type| case type when :after_step log.info "Step Done!" if @step_running when :before_scenario log.info { "Running #{@current_scenario.keyword}: \"#{format_scenario_name step}\"" } when :before_step log.info "Step Done!\n" if @step_running step_name = "#{step.source.last.keyword}#{step.name}" log.info { "Step \"#{step_name}\"" } mdc_add_step! step_name end end end |
#puts(obj) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
79 80 81 82 83 |
# File 'lib/qat/formatter/console.rb', line 79 def puts obj return if @options[:dry_run] log.debug { obj } end |