Class: Datadog::CI::TestSuite

Inherits:
ConcurrentSpan show all
Defined in:
lib/datadog/ci/test_suite.rb

Overview

Represents a single test suite.

Read here on what test suite means: https://docs.datadoghq.com/continuous_integration/explorer/?tab=testruns#suite

This object can be shared between multiple threads.

Instance Attribute Summary

Attributes inherited from Span

#tracer_span

Instance Method Summary collapse

Methods inherited from ConcurrentSpan

#get_tag, #set_metric, #set_tag, #set_tags, #synchronize

Methods inherited from Span

#clear_tag, #failed!, #failed?, #get_tag, #git_branch, #git_commit_sha, #git_repository_url, #id, #name, #os_architecture, #os_platform, #os_version, #passed!, #passed?, #runtime_name, #runtime_version, #service, #set_default_tags, #set_environment_runtime_tags, #set_metric, #set_tag, #set_tags, #skipped!, #skipped?, #to_s, #trace_id, #type, #undefined?

Constructor Details

#initialize(tracer_span) ⇒ TestSuite

Returns a new instance of TestSuite.



16
17
18
19
20
# File 'lib/datadog/ci/test_suite.rb', line 16

def initialize(tracer_span)
  super

  @test_suite_stats = Hash.new(0)
end

Instance Method Details

#failed_tests_countObject



57
58
59
60
61
# File 'lib/datadog/ci/test_suite.rb', line 57

def failed_tests_count
  synchronize do
    @test_suite_stats[Ext::Test::Status::FAIL]
  end
end

#finishvoid

This method returns an undefined value.

Finishes this test suite.



24
25
26
27
28
29
30
31
32
33
# File 'lib/datadog/ci/test_suite.rb', line 24

def finish
  synchronize do
    # we try to derive test suite status from execution stats if no status was set explicitly
    set_status_from_stats! if undefined?

    test_visibility.deactivate_test_suite(name)

    super
  end
end

#passed_tests_countObject



43
44
45
46
47
# File 'lib/datadog/ci/test_suite.rb', line 43

def passed_tests_count
  synchronize do
    @test_suite_stats[Ext::Test::Status::PASS]
  end
end

#record_test_result(datadog_test_status) ⇒ Object



36
37
38
39
40
# File 'lib/datadog/ci/test_suite.rb', line 36

def record_test_result(datadog_test_status)
  synchronize do
    @test_suite_stats[datadog_test_status] += 1
  end
end

#skipped_tests_countObject



50
51
52
53
54
# File 'lib/datadog/ci/test_suite.rb', line 50

def skipped_tests_count
  synchronize do
    @test_suite_stats[Ext::Test::Status::SKIP]
  end
end