Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test_suite_summary.rb « reports « ci « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f9b0bedb7122030ae9b826f1b9dbd77cb176a860 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# frozen_string_literal: true

module Gitlab
  module Ci
    module Reports
      class TestSuiteSummary
        attr_reader :results

        def initialize(results)
          @results = results
        end

        def name
          @name ||= results.first.tests_name
        end

        # rubocop: disable CodeReuse/ActiveRecord
        def build_ids
          results.pluck(:build_id)
        end

        def total_time
          @total_time ||= results.sum(&:tests_duration)
        end

        def success_count
          @success_count ||= results.sum(&:tests_success)
        end

        def failed_count
          @failed_count ||= results.sum(&:tests_failed)
        end

        def skipped_count
          @skipped_count ||= results.sum(&:tests_skipped)
        end

        def error_count
          @error_count ||= results.sum(&:tests_errored)
        end

        def total_count
          @total_count ||= [success_count, failed_count, skipped_count, error_count].sum
        end
        # rubocop: disable CodeReuse/ActiveRecord
      end
    end
  end
end