Class: GitlabQuality::TestTooling::TestResult::JUnitTestResult
- Inherits:
-
BaseTestResult
- Object
- BaseTestResult
- GitlabQuality::TestTooling::TestResult::JUnitTestResult
- Defined in:
- lib/gitlab_quality/test_tooling/test_result/j_unit_test_result.rb
Constant Summary
Constants inherited from BaseTestResult
BaseTestResult::IGNORED_FAILURES, BaseTestResult::SHARED_EXAMPLES_CALLERS
Instance Attribute Summary collapse
-
#testcase ⇒ Object
Ignore it for now.
Attributes inherited from BaseTestResult
Instance Method Summary collapse
- #ci_job_url ⇒ Object
-
#failures ⇒ Object
rubocop:disable Metrics/AbcSize.
- #max_duration_for_test ⇒ Object
- #name ⇒ Object
- #relative_file ⇒ Object
- #skipped? ⇒ Boolean
Methods inherited from BaseTestResult
#calls_shared_examples?, #category, #conditional_quarantine?, #failure_issue, #failure_issue=, #failures?, #feature_category, #feature_category?, #file, #file_base_url, #files_client, #full_stacktrace, #initialize, #level, #line_number, #product_group, #product_group?, #quarantine?, #run_time, #screenshot?, #section, #stage, #test_file_link
Constructor Details
This class inherits a constructor from GitlabQuality::TestTooling::TestResult::BaseTestResult
Instance Attribute Details
#testcase ⇒ Object
Ignore it for now
7 8 9 |
# File 'lib/gitlab_quality/test_tooling/test_result/j_unit_test_result.rb', line 7 def testcase @testcase end |
Instance Method Details
#ci_job_url ⇒ Object
47 48 49 |
# File 'lib/gitlab_quality/test_tooling/test_result/j_unit_test_result.rb', line 47 def ci_job_url ENV.fetch('CI_JOB_URL', '') end |
#failures ⇒ Object
rubocop:disable Metrics/AbcSize
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/gitlab_quality/test_tooling/test_result/j_unit_test_result.rb', line 21 def failures # rubocop:disable Metrics/AbcSize failures = report.search('failure') return [] if failures.empty? failures.map do |exception| trace = exception.content.split("\n").map(&:strip) spec_file_first_index = trace.rindex do |line| report['file'] && line.include?(File.basename(report['file'])) end exception['message'].gsub!(/(private_token=)[\w-]+/, '********') exception['message'].gsub!(/("Authorization": \[\n\s*"token )([\w-]+)/, '\1********') exception.content = exception.content.gsub(/(private_token=)[\w-]+/, '********') exception.content = exception.content.gsub(/("Authorization": \[\n\s*"token )([\w-]+)/, '\1********') { 'message' => "#{exception['type']}: #{exception['message']}", 'stacktrace' => trace.slice(0..spec_file_first_index).join("\n"), 'message_lines' => trace.slice(0..spec_file_first_index) } end end |
#max_duration_for_test ⇒ Object
43 44 45 |
# File 'lib/gitlab_quality/test_tooling/test_result/j_unit_test_result.rb', line 43 def max_duration_for_test '' end |
#name ⇒ Object
9 10 11 |
# File 'lib/gitlab_quality/test_tooling/test_result/j_unit_test_result.rb', line 9 def name report['name'] end |
#relative_file ⇒ Object
13 14 15 |
# File 'lib/gitlab_quality/test_tooling/test_result/j_unit_test_result.rb', line 13 def relative_file report['file']&.delete_prefix('./') end |
#skipped? ⇒ Boolean
17 18 19 |
# File 'lib/gitlab_quality/test_tooling/test_result/j_unit_test_result.rb', line 17 def skipped? report.search('skipped').any? end |