Class: Gitlab::Ci::Reports::TestCase
- Inherits:
-
Object
- Object
- Gitlab::Ci::Reports::TestCase
- Defined in:
- lib/gitlab/ci/reports/test_case.rb
Constant Summary collapse
- STATUS_SUCCESS =
'success'
- STATUS_FAILED =
'failed'
- STATUS_SKIPPED =
'skipped'
- STATUS_ERROR =
'error'
- STATUS_TYPES =
[STATUS_ERROR, STATUS_FAILED, STATUS_SUCCESS, STATUS_SKIPPED].freeze
Instance Attribute Summary collapse
-
#attachment ⇒ Object
readonly
Returns the value of attribute attachment.
-
#classname ⇒ Object
readonly
Returns the value of attribute classname.
-
#execution_time ⇒ Object
readonly
Returns the value of attribute execution_time.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#job ⇒ Object
readonly
Returns the value of attribute job.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#recent_failures ⇒ Object
readonly
Returns the value of attribute recent_failures.
-
#stack_trace ⇒ Object
readonly
Returns the value of attribute stack_trace.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#suite_name ⇒ Object
readonly
Returns the value of attribute suite_name.
-
#system_output ⇒ Object
readonly
Returns the value of attribute system_output.
Instance Method Summary collapse
- #attachment_url ⇒ Object
- #has_attachment? ⇒ Boolean
-
#initialize(params) ⇒ TestCase
constructor
A new instance of TestCase.
- #set_recent_failures(count, base_branch) ⇒ Object
Constructor Details
#initialize(params) ⇒ TestCase
Returns a new instance of TestCase.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/gitlab/ci/reports/test_case.rb', line 15 def initialize(params) @suite_name = params.fetch(:suite_name) @name = params.fetch(:name) @classname = params.fetch(:classname) @file = params.fetch(:file, nil) @execution_time = params.fetch(:execution_time).to_f @status = params.fetch(:status) @system_output = params.fetch(:system_output, nil) @stack_trace = params.fetch(:stack_trace, nil) @attachment = params.fetch(:attachment, nil) @job = params.fetch(:job, nil) @recent_failures = nil @key = hash_key("#{suite_name}_#{classname}_#{name}") end |
Instance Attribute Details
#attachment ⇒ Object (readonly)
Returns the value of attribute attachment.
13 14 15 |
# File 'lib/gitlab/ci/reports/test_case.rb', line 13 def @attachment end |
#classname ⇒ Object (readonly)
Returns the value of attribute classname.
13 14 15 |
# File 'lib/gitlab/ci/reports/test_case.rb', line 13 def classname @classname end |
#execution_time ⇒ Object (readonly)
Returns the value of attribute execution_time.
13 14 15 |
# File 'lib/gitlab/ci/reports/test_case.rb', line 13 def execution_time @execution_time end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
13 14 15 |
# File 'lib/gitlab/ci/reports/test_case.rb', line 13 def file @file end |
#job ⇒ Object (readonly)
Returns the value of attribute job.
13 14 15 |
# File 'lib/gitlab/ci/reports/test_case.rb', line 13 def job @job end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
13 14 15 |
# File 'lib/gitlab/ci/reports/test_case.rb', line 13 def key @key end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
13 14 15 |
# File 'lib/gitlab/ci/reports/test_case.rb', line 13 def name @name end |
#recent_failures ⇒ Object (readonly)
Returns the value of attribute recent_failures.
13 14 15 |
# File 'lib/gitlab/ci/reports/test_case.rb', line 13 def recent_failures @recent_failures end |
#stack_trace ⇒ Object (readonly)
Returns the value of attribute stack_trace.
13 14 15 |
# File 'lib/gitlab/ci/reports/test_case.rb', line 13 def stack_trace @stack_trace end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
13 14 15 |
# File 'lib/gitlab/ci/reports/test_case.rb', line 13 def status @status end |
#suite_name ⇒ Object (readonly)
Returns the value of attribute suite_name.
13 14 15 |
# File 'lib/gitlab/ci/reports/test_case.rb', line 13 def suite_name @suite_name end |
#system_output ⇒ Object (readonly)
Returns the value of attribute system_output.
13 14 15 |
# File 'lib/gitlab/ci/reports/test_case.rb', line 13 def system_output @system_output end |
Instance Method Details
#attachment_url ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/gitlab/ci/reports/test_case.rb', line 40 def return unless Rails.application.routes.url_helpers.file_project_job_artifacts_path( job.project, job.id, ) end |
#has_attachment? ⇒ Boolean
36 37 38 |
# File 'lib/gitlab/ci/reports/test_case.rb', line 36 def .present? end |
#set_recent_failures(count, base_branch) ⇒ Object
32 33 34 |
# File 'lib/gitlab/ci/reports/test_case.rb', line 32 def set_recent_failures(count, base_branch) @recent_failures = { count: count, base_branch: base_branch } end |