Class: GitlabQuality::TestTooling::Report::ReportResults

Inherits:
ReportAsIssue
  • Object
show all
Defined in:
lib/gitlab_quality/test_tooling/report/report_results.rb

Overview

Uses the API to:

  • create or update test cases

  • create or update issues

based on the results of tests from RSpec run result files.

Constant Summary

Constants included from Concerns::Utils

Concerns::Utils::MAX_TITLE_LENGTH

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ReportAsIssue

#invoke!

Methods included from Concerns::Utils

#label_names_to_label_quick_action, #new_issue_title, #partial_file_path, #pipeline, #readable_duration, #search_safe, #title_from_test

Constructor Details

#initialize(test_case_project_token:, results_issue_project_token:, input_files:, test_case_project: nil, results_issue_project: nil, dry_run: false, **kwargs) ⇒ ReportResults

Returns a new instance of ReportResults.



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/gitlab_quality/test_tooling/report/report_results.rb', line 14

def initialize(
  test_case_project_token:, results_issue_project_token:, input_files:, test_case_project: nil, results_issue_project: nil, dry_run: false,
  **kwargs)
  @test_case_project_token = test_case_project_token
  @testcase_project_reporter = GitlabQuality::TestTooling::Report::ResultsInTestCases.new(
    token: test_case_project_token, input_files: input_files, project: test_case_project, dry_run: dry_run, **kwargs)
  @results_issue_project_reporter = GitlabQuality::TestTooling::Report::ResultsInIssues.new(
    token: results_issue_project_token, input_files: input_files, project: results_issue_project, dry_run: dry_run, **kwargs)
  @test_case_project = test_case_project
  @results_issue_project = results_issue_project
  @files = Array(input_files)
  @gitlab = testcase_project_reporter.gitlab
end

Instance Attribute Details

#filesObject

Returns the value of attribute files.



11
12
13
# File 'lib/gitlab_quality/test_tooling/report/report_results.rb', line 11

def files
  @files
end

#gitlabObject

Returns the value of attribute gitlab.



11
12
13
# File 'lib/gitlab_quality/test_tooling/report/report_results.rb', line 11

def gitlab
  @gitlab
end

#results_issue_projectObject

Returns the value of attribute results_issue_project.



11
12
13
# File 'lib/gitlab_quality/test_tooling/report/report_results.rb', line 11

def results_issue_project
  @results_issue_project
end

#results_issue_project_reporterObject

Returns the value of attribute results_issue_project_reporter.



11
12
13
# File 'lib/gitlab_quality/test_tooling/report/report_results.rb', line 11

def results_issue_project_reporter
  @results_issue_project_reporter
end

#test_case_projectObject

Returns the value of attribute test_case_project.



11
12
13
# File 'lib/gitlab_quality/test_tooling/report/report_results.rb', line 11

def test_case_project
  @test_case_project
end

#testcase_project_reporterObject

Returns the value of attribute testcase_project_reporter.



11
12
13
# File 'lib/gitlab_quality/test_tooling/report/report_results.rb', line 11

def testcase_project_reporter
  @testcase_project_reporter
end

Instance Method Details

#validate_input!Object



28
29
30
31
# File 'lib/gitlab_quality/test_tooling/report/report_results.rb', line 28

def validate_input!
  assert_input_files!(files)
  gitlab.assert_user_permission!
end