debian-mirror-gitlab/app/serializers/test_suite_entity.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
978 B
Ruby
Raw Permalink Normal View History

2019-12-21 20:55:43 +05:30
# frozen_string_literal: true
class TestSuiteEntity < Grape::Entity
2023-01-13 00:05:48 +05:30
expose :name, documentation: { type: 'string', example: 'test' }
expose :total_time, documentation: { type: 'integer', example: 1904 }
expose :total_count, documentation: { type: 'integer', example: 3363 }
2019-12-21 20:55:43 +05:30
2023-01-13 00:05:48 +05:30
expose :success_count, documentation: { type: 'integer', example: 3351 }
expose :failed_count, documentation: { type: 'integer', example: 0 }
expose :skipped_count, documentation: { type: 'integer', example: 12 }
expose :error_count, documentation: { type: 'integer', example: 0 }
2019-12-21 20:55:43 +05:30
2020-07-28 23:09:34 +05:30
with_options if: -> (_, opts) { opts[:details] } do |test_suite|
2023-01-13 00:05:48 +05:30
expose :suite_error,
documentation: { type: 'string', example: 'JUnit XML parsing failed: 1:1: FATAL: Document is empty' }
expose :test_cases, using: TestCaseEntity, documentation: { is_array: true } do |test_suite|
2020-11-24 15:15:51 +05:30
test_suite.suite_error ? [] : test_suite.sorted.test_cases.values.flat_map(&:values)
2020-07-28 23:09:34 +05:30
end
2019-12-21 20:55:43 +05:30
end
end