Class: QTestScenario::QTestScenarioUtils
- Inherits:
-
Object
- Object
- QTestScenario::QTestScenarioUtils
- Defined in:
- lib/utils/q_test_scenario_utils.rb
Class Method Summary collapse
- .create_execution(server, api_key) ⇒ Object
- .get_feature_files(keys, jql, server, apiKey) ⇒ Object
- .load_feature_mapping_file(destination_dir) ⇒ Object
- .submit_feature_test_log(feature_test_log, server, api_key) ⇒ Object
- .update_execution(execution, server, api_key) ⇒ Object
Class Method Details
.create_execution(server, api_key) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# 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) ⇒ Object
11 12 13 14 15 16 17 |
# 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) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 |
# 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, | = FeatureMeta.from_json feature_mappings_map[feature_name] = } end feature_mappings_map end |
.submit_feature_test_log(feature_test_log, server, api_key) ⇒ Object
51 52 53 54 55 56 57 58 59 |
# 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) ⇒ Object
30 31 32 33 34 35 36 37 |
# 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 |