Class: QAT::Reporter::Xray::TestExecution

Inherits:
Issue
  • Object
show all
Defined in:
lib/qat/reporter/xray/test_execution.rb

Overview

QAT::Reporter::Xray::TestExecution represents a Xray Test Execution object

Instance Attribute Summary

Attributes inherited from Issue

#jira_id

Instance Method Summary collapse

Methods inherited from Issue

#initialize

Constructor Details

This class inherits a constructor from QAT::Reporter::Xray::Issue

Instance Method Details

#create(options = {}) ⇒ Object

Creates a Test Execution issue in Jira



11
12
13
14
15
16
17
# File 'lib/qat/reporter/xray/test_execution.rb', line 11

def create(options = {})
  data               = test_execution_defaults.merge(options)
  response           = super(data)
  test_execution_key = JSON.parse(response)['key']
  puts "Created test execution with key: '#{test_execution_key}', saving in 'XRAY_TEST_EXECUTION' env variable."
  ENV['XRAY_TEST_EXECUTION'] = test_execution_key
end

#import_execution_results(execution_results, info = {}) ⇒ Object

Posts the execution json results in Xray



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/qat/reporter/xray/test_execution.rb', line 20

def import_execution_results(execution_results, info = {})
  puts execution_results
  if jira_id
    issue_info                    = info.merge(default_update_headers(execution_results))
    issue_info[:testExecutionKey] = jira_id
  else
    issue_info = info.merge(default_create_headers(execution_results))
  end
  #If no test execution found, Xray will create one automatically
  QAT::Reporter::Xray::Config.publisher.send_execution_results(issue_info)
end