Class: QAT::Formatter::TestIds
- Inherits:
-
Object
- Object
- QAT::Formatter::TestIds
- Includes:
- Cucumber::Formatter::Io
- Defined in:
- lib/qat/formatter/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.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/qat/formatter/test_ids.rb', line 9 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
56 57 58 59 |
# File 'lib/qat/formatter/test_ids.rb', line 56 def after_features(features) publish_result @io.flush end |
#after_tags(tags) ⇒ Object
28 29 30 |
# File 'lib/qat/formatter/test_ids.rb', line 28 def () @in_scenarios = true unless @in_scenarios end |
#before_feature(feature) ⇒ Object
20 21 22 |
# File 'lib/qat/formatter/test_ids.rb', line 20 def before_feature(feature) @in_scenarios = false end |
#scenario_name(keyword, name, file_colon_line, source_indent) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/qat/formatter/test_ids.rb', line 32 def scenario_name(keyword, name, file_colon_line, source_indent) if @scenario_tags.any? { |tag| tag.match(/@test#(\d+)/) } id = @scenario_tags.map { |tag| tag.match(/@test#(\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
24 25 26 |
# File 'lib/qat/formatter/test_ids.rb', line 24 def tag_name(tag_name) @scenario_tags << tag_name if @in_scenarios end |