Class: QAT::Formatter::Xray::TestIds
- Inherits:
-
Object
- Object
- QAT::Formatter::Xray::TestIds
- Includes:
- Cucumber::Formatter::Io
- Defined in:
- lib/qat/formatter/xray/test_ids.rb
Overview
Instance Method Summary collapse
- #after_features(features) ⇒ Object
- #after_tags(tags) ⇒ Object
- #before_feature(feature) ⇒ Object
-
#initialize(runtime, path_or_io, options) ⇒ TestIds
constructor
A new instance of TestIds.
- #scenario_name(keyword, name, file_colon_line, source_indent) ⇒ Object
- #tag_name(tag_name) ⇒ Object
Constructor Details
#initialize(runtime, path_or_io, options) ⇒ TestIds
Returns a new instance of TestIds.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/qat/formatter/xray/test_ids.rb', line 10 def initialize(runtime, path_or_io, ) @io = ensure_io(path_or_io) @tags = [] @scenario_tags = [] @no_test_id = {} @max_test_id = 0 @duplicate_test_ids = {} @test_id_mapping = {} @options = end |
Instance Method Details
#after_features(features) ⇒ Object
57 58 59 60 |
# File 'lib/qat/formatter/xray/test_ids.rb', line 57 def after_features(features) publish_result @io.flush end |
#after_tags(tags) ⇒ Object
29 30 31 |
# File 'lib/qat/formatter/xray/test_ids.rb', line 29 def () @in_scenarios = true unless @in_scenarios end |
#before_feature(feature) ⇒ Object
21 22 23 |
# File 'lib/qat/formatter/xray/test_ids.rb', line 21 def before_feature(feature) @in_scenarios = false end |
#scenario_name(keyword, name, file_colon_line, source_indent) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/qat/formatter/xray/test_ids.rb', line 33 def scenario_name(keyword, name, file_colon_line, source_indent) if @scenario_tags.any? { |tag| tag.match(/@id:(\d+)/) } id = @scenario_tags.map { |tag| tag.match(/@id:(\d+)/) }.compact.first.captures.first.to_i @max_test_id = id if id > @max_test_id test_id_info = { name: name, path: file_colon_line } if @test_id_mapping[id] if @duplicate_test_ids[id] @duplicate_test_ids[id] << test_id_info else @duplicate_test_ids[id] = [@test_id_mapping[id], test_id_info] end else @test_id_mapping[id] = test_id_info end else @no_test_id[name] = file_colon_line unless @scenario_tags.include?('@dummy_test') end @scenario_tags = [] end |
#tag_name(tag_name) ⇒ Object
25 26 27 |
# File 'lib/qat/formatter/xray/test_ids.rb', line 25 def tag_name(tag_name) @scenario_tags << tag_name if @in_scenarios end |