# frozen_string_literal: true require_relative "span" module Datadog module CI # Represents a single part of a test run. # # @public_api class Test < Span # @return [String] the name of the test. def name get_tag(Ext::Test::TAG_NAME) end # Finishes the current test. # @return [void] def finish super CI.deactivate_test(self) end # Running test suite that this test is part of (if any). # @return [Datadog::CI::TestSuite] the test suite this test belongs to # @return [nil] if the test suite is not found def test_suite suite_name = test_suite_name CI.active_test_suite(suite_name) if suite_name end # Span id of the running test suite this test belongs to. # @return [String] the span id of the test suite. def test_suite_id get_tag(Ext::Test::TAG_TEST_SUITE_ID) end def test_suite_name get_tag(Ext::Test::TAG_SUITE) end # Span id of the running test module this test belongs to. # @return [String] the span id of the test module. def test_module_id get_tag(Ext::Test::TAG_TEST_MODULE_ID) end # Span id of the running test module this test belongs to. # @return [String] the span id of the test session. def test_session_id get_tag(Ext::Test::TAG_TEST_SESSION_ID) end end end end