class QTestScenario::QTestScenarioUtils

Public Class Methods

create_execution(server, api_key) click to toggle source
# File lib/utils/q_test_scenario_utils.rb, line 19
def self.create_execution(server, api_key)
  execution = ExecutionLog.new
  response = RestClient.post(
      server + Constants.getCreateExecutionUri,
      execution.to_json,
      { :Authorization => api_key, :content_type => 'application/json' }
  )
  result = JSON.parse response
  ExecutionLog.from_json(result)
end
get_feature_files(keys, jql, server, apiKey) click to toggle source
# File lib/utils/q_test_scenario_utils.rb, line 11
def self.get_feature_files(keys, jql, server, apiKey)
  params = '?keys=' + keys if (!keys.nil? && !keys.empty?)
  params = '?jql=' + CGI::escape(jql) if (!jql.nil? && !jql.empty?)

  resource = RestClient::Resource.new(server + Constants.getFeatureFilesUri  + params)
  response = resource.get( :Authorization => apiKey )
end
load_feature_mapping_file(destination_dir) click to toggle source
# File lib/utils/q_test_scenario_utils.rb, line 39
def self.load_feature_mapping_file(destination_dir)
  feature_mappings_map = Hash.new
  File.open(destination_dir + Constants.getMappingFileName, 'r') do |f|
    feature_mappings = JSON.parse f.read
    feature_mappings.each { |feature_name, feature_meta_json|
      feature_meta = FeatureMeta.from_json feature_meta_json
      feature_mappings_map[feature_name] = feature_meta
    }
  end
  feature_mappings_map
end
submit_feature_test_log(feature_test_log, server, api_key) click to toggle source
# File lib/utils/q_test_scenario_utils.rb, line 51
def self.submit_feature_test_log (feature_test_log, server, api_key)

  uri = Constants.getSubmitFeatureTestLogUri % [feature_test_log.featureId]
  response = RestClient.post(
      server + uri,
      feature_test_log.to_json,
      { :Authorization => api_key, :content_type => 'application/json' }
  )
end
update_execution(execution, server, api_key) click to toggle source
# File lib/utils/q_test_scenario_utils.rb, line 30
def self.update_execution (execution, server, api_key)
  uri = Constants.getUpdateExecutionUri % [execution.executionId]
  RestClient.put(
      server + uri,
      execution.to_json,
      { :Authorization => api_key, :content_type => 'application/json' }
  )
end