Class: Gitlab::QA::Report::ResultsInIssues
- Inherits:
-
Object
- Object
- Gitlab::QA::Report::ResultsInIssues
- Defined in:
- lib/gitlab/qa/report/results_in_issues.rb
Overview
Uses the API to create or update GitLab issues with the results of tests from RSpec report files. The GitLab client is used for API access: github.com/NARKOZ/gitlab
Constant Summary collapse
- MAINTAINER_ACCESS_LEVEL =
40
- MAX_TITLE_LENGTH =
255
Instance Method Summary collapse
-
#initialize(token:, input_files:, project: nil) ⇒ ResultsInIssues
constructor
A new instance of ResultsInIssues.
- #invoke! ⇒ Object
Constructor Details
#initialize(token:, input_files:, project: nil) ⇒ ResultsInIssues
Returns a new instance of ResultsInIssues.
23 24 25 26 27 |
# File 'lib/gitlab/qa/report/results_in_issues.rb', line 23 def initialize(token:, input_files:, project: nil) @token = token @files = Array(input_files) @project = project end |
Instance Method Details
#invoke! ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/gitlab/qa/report/results_in_issues.rb', line 29 def invoke! configure_gitlab_client validate_input! puts "Reporting test results in `#{files.join(',')}` as issues in project `#{project}` via the API at `#{Runtime::Env.gitlab_api_base}`." Dir.glob(files).each do |file| puts "Reporting tests in #{file}" Nokogiri::XML(File.open(file)).xpath('//testcase').each do |test| report_test(test) end end end |