Class: QAT::Reporter::Xray::Publisher::Hosted

Inherits:
Base
  • Object
show all
Defined in:
lib/qat/reporter/xray/publisher/hosted.rb

Overview

QAT::Reporter::Xray::Publisher::Hosted integrator class

Instance Attribute Summary

Attributes inherited from Base

#base_url, #cloud_xray_api_credentials, #default_cloud_api_url, #default_headers, #login_credentials

Instance Method Summary collapse

Methods inherited from Base

#cloud_graphql_headers, #create_issue, #initialize

Constructor Details

This class inherits a constructor from QAT::Reporter::Xray::Publisher::Base

Instance Method Details

#export_test_scenarios(keys, filter = nil) ⇒ Object

Export Xray test scenarios to a zip file via API

Parameters:

  • keys (String)

    test scenarios

  • filter (String) (defaults to: nil)

    project filter

See Also:



38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/qat/reporter/xray/publisher/hosted.rb', line 38

def export_test_scenarios(keys, filter = nil)
	params          = {
		keys: keys,
		fz:   true
	}
	
	params[:filter] = filter if filter.present?
	
	headers = default_headers.merge(params: params)
	
	RestClient.get("#{base_url}/rest/raven/1.0/export/test", headers)
end

#import_cucumber_tests(project_key, file_path) ⇒ Object

Import Cucumber features files as a zip file via API

Parameters:

  • project_key (String)

    JIRA’s project key

  • file_path (String)

    Cucumber features files’ zip file

See Also:



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/qat/reporter/xray/publisher/hosted.rb', line 22

def import_cucumber_tests(project_key, file_path)
	headers = default_headers.merge({
																		multipart: true,
																		params:    {
																			projectKey: project_key
																		}
																	})
	payload = { file: File.new(file_path, 'rb') }
	
	Client.new(base_url).post('/rest/raven/1.0/import/feature', payload, headers)
end

#send_execution_results(results) ⇒ Object

Posts the execution json results in Xray

Parameters:

  • results (String)

    Execution results



14
15
16
# File 'lib/qat/reporter/xray/publisher/hosted.rb', line 14

def send_execution_results(results)
	Client.new(base_url).post('/rest/raven/1.0/import/execution', results.to_json, default_headers)
end