Class: Gitlab::Ci::Reports::TestReport
- Inherits:
-
Object
- Object
- Gitlab::Ci::Reports::TestReport
- Defined in:
- lib/gitlab/ci/reports/test_report.rb
Instance Attribute Summary collapse
-
#test_suites ⇒ Object
readonly
Returns the value of attribute test_suites.
Instance Method Summary collapse
- #get_suite(suite_name) ⇒ Object
-
#initialize ⇒ TestReport
constructor
A new instance of TestReport.
- #suite_errors ⇒ Object
- #total_count ⇒ Object
- #total_status ⇒ Object
- #total_time ⇒ Object
- #with_attachment! ⇒ Object
Constructor Details
#initialize ⇒ TestReport
Returns a new instance of TestReport.
9 10 11 |
# File 'lib/gitlab/ci/reports/test_report.rb', line 9 def initialize @test_suites = {} end |
Instance Attribute Details
#test_suites ⇒ Object (readonly)
Returns the value of attribute test_suites.
7 8 9 |
# File 'lib/gitlab/ci/reports/test_report.rb', line 7 def test_suites @test_suites end |
Instance Method Details
#get_suite(suite_name) ⇒ Object
13 14 15 |
# File 'lib/gitlab/ci/reports/test_report.rb', line 13 def get_suite(suite_name) test_suites[suite_name] ||= TestSuite.new(suite_name) end |
#suite_errors ⇒ Object
41 42 43 |
# File 'lib/gitlab/ci/reports/test_report.rb', line 41 def suite_errors test_suites.transform_values(&:suite_error).compact end |
#total_count ⇒ Object
21 22 23 |
# File 'lib/gitlab/ci/reports/test_report.rb', line 21 def total_count test_suites.values.sum(&:total_count) end |
#total_status ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/gitlab/ci/reports/test_report.rb', line 25 def total_status if failed_count > 0 || error_count > 0 TestCase::STATUS_FAILED else TestCase::STATUS_SUCCESS end end |
#total_time ⇒ Object
17 18 19 |
# File 'lib/gitlab/ci/reports/test_report.rb', line 17 def total_time test_suites.values.sum(&:total_time) end |
#with_attachment! ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/gitlab/ci/reports/test_report.rb', line 33 def @test_suites.keep_if do |_job_name, test_suite| test_suite..present? end self end |