lib/datadog/ci/contrib/cucumber/formatter.rb in datadog-ci-1.0.0.beta1 vs lib/datadog/ci/contrib/cucumber/formatter.rb in datadog-ci-1.0.0.beta2
- old
+ new
@@ -1,9 +1,10 @@
# frozen_string_literal: true
require_relative "../../ext/test"
-require_relative "../../utils/git"
+require_relative "../../git/local_repository"
+require_relative "../../utils/test_run"
require_relative "ext"
module Datadog
module CI
module Contrib
@@ -53,28 +54,29 @@
end
def on_test_case_started(event)
test_suite_name = test_suite_name(event.test_case)
+ # @type var tags: Hash[String, String]
tags = {
CI::Ext::Test::TAG_FRAMEWORK => Ext::FRAMEWORK,
CI::Ext::Test::TAG_FRAMEWORK_VERSION => CI::Contrib::Cucumber::Integration.version.to_s,
- CI::Ext::Test::TAG_SOURCE_FILE => Utils::Git.relative_to_root(event.test_case.location.file),
+ CI::Ext::Test::TAG_SOURCE_FILE => Git::LocalRepository.relative_to_root(event.test_case.location.file),
CI::Ext::Test::TAG_SOURCE_START => event.test_case.location.line.to_s
}
+ if (parameters = extract_parameters_hash(event.test_case))
+ tags[CI::Ext::Test::TAG_PARAMETERS] = Utils::TestRun.test_parameters(arguments: parameters)
+ end
+
start_test_suite(test_suite_name) unless same_test_suite_as_current?(test_suite_name)
- test_span = CI.start_test(
+ CI.start_test(
event.test_case.name,
test_suite_name,
tags: tags,
service: configuration[:service_name]
)
-
- if (parameters = extract_parameters_hash(event.test_case))
- test_span&.set_parameters(parameters)
- end
end
def on_test_case_finished(event)
test_span = CI.active_test
return if test_span.nil?