Class: QAT::Formatter::Xray::TestIds
- Inherits:
-
TestIds
- Object
- TestIds
- QAT::Formatter::Xray::TestIds
- Includes:
- Cucumber::Formatter::Io, Helper
- Defined in:
- lib/qat/formatter/xray/test_ids.rb
Overview
Instance Method Summary collapse
-
#initialize(config) ⇒ TestIds
constructor
A new instance of TestIds.
-
#scenario_name ⇒ Object
Override because of tag condition.
Constructor Details
#initialize(config) ⇒ TestIds
Returns a new instance of TestIds.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/qat/formatter/xray/test_ids.rb', line 13 def initialize(config) @config = config @no_test_id = {} @max_test_id = 0 @duplicate_test_ids = {} @test_id_mapping = {} @io = ensure_io(config.out_stream, config.error_stream) @ast_lookup = ::Cucumber::Formatter::AstLookup.new(@config) config.on_event :test_case_started, &method(:on_test_case_started) config.on_event :test_run_finished, &method(:on_test_run_finished) end |
Instance Method Details
#scenario_name ⇒ Object
Override because of tag condition
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/qat/formatter/xray/test_ids.rb', line 27 def scenario_name path = "#{@current_feature[:uri]}:#{@scenario[:line]}" = @scenario[:tags] if .any? { |tag| tag.match(/@id:(\d+)/) } id = .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: @scenario[:name], path: path} if @test_id_mapping[id] if @duplicate_test_ids[id] @duplicate_test_ids[id].find do |dup| @exist = true if dup[:path]== test_id_info[:path] end @duplicate_test_ids[id] << test_id_info unless @exist else @duplicate_test_ids[id] = [@test_id_mapping[id], test_id_info] unless @test_id_mapping[id][:path] == test_id_info[:path] end else @test_id_mapping[id] = test_id_info end else @no_test_id[@scenario[:name]] = path unless .include?('@dummy_test') end @scenario[:tags] = [] end |