summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/reports/test_report_summary.rb
blob: 85b83b790e7a856eb53e0d4ff5b526b87c1c461a (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 TestReportSummary
        attr_reader :all_results

        def initialize(all_results)
          @all_results = all_results
        end

        def total
          TestSuiteSummary.new(all_results)
        end

        def total_time
          total.total_time
        end

        def total_count
          total.total_count
        end

        def success_count
          total.success_count
        end

        def failed_count
          total.failed_count
        end

        def skipped_count
          total.skipped_count
        end

        def error_count
          total.error_count
        end

        def test_suites
          all_results
            .group_by(&:tests_name)
            .transform_values { |results| TestSuiteSummary.new(results) }
        end
      end
    end
  end
end