debian-mirror-gitlab/lib/gitlab/ci/reports/test_case.rb

35 lines
985 B
Ruby
Raw Normal View History

2018-12-13 13:39:08 +05:30
# frozen_string_literal: true
2018-11-18 11:00:15 +05:30
module Gitlab
module Ci
module Reports
class TestCase
2019-12-04 20:38:33 +05:30
STATUS_SUCCESS = 'success'
STATUS_FAILED = 'failed'
STATUS_SKIPPED = 'skipped'
STATUS_ERROR = 'error'
2018-11-18 11:00:15 +05:30
STATUS_TYPES = [STATUS_SUCCESS, STATUS_FAILED, STATUS_SKIPPED, STATUS_ERROR].freeze
attr_reader :name, :classname, :execution_time, :status, :file, :system_output, :stack_trace, :key
def initialize(name:, classname:, execution_time:, status:, file: nil, system_output: nil, stack_trace: nil)
@name = name
@classname = classname
@file = file
@execution_time = execution_time.to_f
@status = status
@system_output = system_output
@stack_trace = stack_trace
@key = sanitize_key_name("#{classname}_#{name}")
end
private
def sanitize_key_name(key)
key.gsub(/[^0-9A-Za-z]/, '-')
end
end
end
end
end