Module: QAT::Formatter::Loggable::Mdc
- Includes:
- ScenarioInfo
- Included in:
- QAT::Formatter::Loggable
- Defined in:
- lib/qat/formatter/loggable/mdc.rb
Overview
Helper module to manage loggable mdc information
Instance Method Summary collapse
- #mdc_add_status_failed! ⇒ Object
-
#mdc_add_step!(step_name) ⇒ Object
Set the MDC key ‘step’ with the given value.
-
#mdc_after_feature! ⇒ Object
Remove the MDC key ‘feature’.
-
#mdc_before_feature!(feature_name) ⇒ Object
Set the MDC key ‘feature’ with the given value.
-
#mdc_before_scenario!(scenario_name, tags, outline_number = nil, outline_example = nil) ⇒ Object
Set the MDC key ‘scenario’ with the given value.
-
#mdc_remove_step! ⇒ Object
Remove the MDC key ‘step’.
-
#mdc_reset_scenario! ⇒ Object
Remove the MDC key ‘scenario’.
Instance Method Details
#mdc_add_status_failed! ⇒ Object
68 69 70 |
# File 'lib/qat/formatter/loggable/mdc.rb', line 68 def mdc_add_status_failed! Log4r::MDC.put 'status', 'failed' end |
#mdc_add_step!(step_name) ⇒ Object
Set the MDC key ‘step’ with the given value.
58 59 60 |
# File 'lib/qat/formatter/loggable/mdc.rb', line 58 def mdc_add_step!(step_name) Log4r::MDC.put 'step', step_name end |
#mdc_after_feature! ⇒ Object
Remove the MDC key ‘feature’.
21 22 23 |
# File 'lib/qat/formatter/loggable/mdc.rb', line 21 def mdc_after_feature! Log4r::MDC.remove 'feature' end |
#mdc_before_feature!(feature_name) ⇒ Object
Set the MDC key ‘feature’ with the given value.
15 16 17 |
# File 'lib/qat/formatter/loggable/mdc.rb', line 15 def mdc_before_feature!(feature_name) Log4r::MDC.put 'feature', feature_name end |
#mdc_before_scenario!(scenario_name, tags, outline_number = nil, outline_example = nil) ⇒ Object
Set the MDC key ‘scenario’ with the given value. Optionally scenario outline data can also be provided
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/qat/formatter/loggable/mdc.rb', line 32 def mdc_before_scenario!(scenario_name, , outline_number = nil, outline_example = nil) mdc_reset_scenario! Log4r::MDC.put 'scenario', scenario_name test_id = test_id(, outline_number) Log4r::MDC.put 'test_id', test_id = .reject { |tag| tag.match(/^\@test\#/) } Log4r::MDC.put 'tags', Log4r::MDC.put 'outline_number', outline_number if outline_number Log4r::MDC.put 'outline_example', outline_example if outline_example end |
#mdc_remove_step! ⇒ Object
Remove the MDC key ‘step’.
64 65 66 |
# File 'lib/qat/formatter/loggable/mdc.rb', line 64 def mdc_remove_step! Log4r::MDC.remove 'step' end |
#mdc_reset_scenario! ⇒ Object
Remove the MDC key ‘scenario’. Other options set in #mdc_before_scenario! will also be unset.
47 48 49 50 51 52 53 |
# File 'lib/qat/formatter/loggable/mdc.rb', line 47 def mdc_reset_scenario! mdc_remove_step! Log4r::MDC.remove 'scenario' Log4r::MDC.remove 'tags' Log4r::MDC.remove 'outline_number' Log4r::MDC.remove 'outline_example' end |