Module: Datadog::CI::Contrib::Cucumber::Instrumentation::InstanceMethods

Defined in:
lib/datadog/ci/contrib/cucumber/instrumentation.rb

Overview

Instance methods for configuration

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#datadog_formatterObject (readonly)

Returns the value of attribute datadog_formatter.



17
18
19
# File 'lib/datadog/ci/contrib/cucumber/instrumentation.rb', line 17

def datadog_formatter
  @datadog_formatter
end

Instance Method Details

#begin_scenario(test_case) ⇒ Object



39
40
41
42
43
44
45
# File 'lib/datadog/ci/contrib/cucumber/instrumentation.rb', line 39

def begin_scenario(test_case)
  if Datadog::CI.active_test&.skipped_by_itr?
    raise ::Cucumber::Core::Test::Result::Skipped, CI::Ext::Test::ITR_TEST_SKIP_REASON
  end

  super
end

#filtersObject



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/datadog/ci/contrib/cucumber/instrumentation.rb', line 25

def filters
  require_relative "filter"

  filters_list = super
  datadog_filter = Filter.new(@configuration)
  unless @configuration.dry_run?
    # insert our filter the pre-last position because Cucumber::Filters::PrepareWorld must be the last one
    # see:
    # https://github.com/cucumber/cucumber-ruby/blob/58dd8f12c0ac5f4e607335ff2e7d385c1ed25899/lib/cucumber/runtime.rb#L266
    filters_list.insert(-2, datadog_filter)
  end
  filters_list
end

#formattersObject



19
20
21
22
23
# File 'lib/datadog/ci/contrib/cucumber/instrumentation.rb', line 19

def formatters
  existing_formatters = super
  @datadog_formatter ||= Formatter.new(@configuration)
  [@datadog_formatter] + existing_formatters
end