itriagetestrail 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9d21b60356ba0ddfe516b011a8a912bd61181f7d
4
- data.tar.gz: 4dcfa425b6a4c62d861ccf2578832c3cb2062b61
3
+ metadata.gz: f35d2994320ffa218fcd8ab70a15b9b97e23b07a
4
+ data.tar.gz: 7448966bf55811e48f275701d95f6bdbefc7e1c1
5
5
  SHA512:
6
- metadata.gz: '02390035683f9cd1ff2264f20af584ee039d7630aea9d134f04975a4fb9914c671b08357c636343a462d553f533f5e6df08c5e9d3bfcae6add3e3832565b76aa'
7
- data.tar.gz: 77e5e1831e7e7596203944bd3c4f7bd68f206d21e81994c53ce3b816020e2d32af6387b97733609f5f93e106e8ada7456cfebfcee0620cae3549b82710b14770
6
+ metadata.gz: a4242607687c8b7d51d025810e66fc7a9cf67f9b8dc84d4f8b7504a53ebcbef9d9aae8dc1b78f4a0378a5d6ebf10c33f127867c2f61f7a9204991636f91dc42d
7
+ data.tar.gz: 70e37c17bee8cb1f4ba95ac4d28d0eb13c8177e04a20b17f242dc49b4f71947b2177f7d2a6d3e5060bbe390cf79371ef1353d67d5e80332e05cb65aba58d9997
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'itriagetestrail/version'
2
4
  require_relative 'itriagetestrail/testrail_binding'
3
5
 
@@ -15,7 +17,6 @@ require 'tzinfo'
15
17
 
16
18
  module Itriagetestrail
17
19
  class TestRailInterface
18
-
19
20
  include Projects
20
21
  include Suites
21
22
  include Milestones
@@ -36,7 +37,7 @@ module Itriagetestrail
36
37
  attr_reader :results
37
38
  attr_reader :external_results
38
39
 
39
- def initialize()
40
+ def initialize
40
41
  @setup = false
41
42
  config
42
43
 
@@ -54,17 +55,17 @@ module Itriagetestrail
54
55
  @app_version = @testrail_config[:appVersion]
55
56
  @suite_name = @testrail_config[:suiteName]
56
57
 
57
- if @testrail_config[:tzinfoTimeZone].nil? || @testrail_config[:tzinfoTimeZone].empty?
58
- @time_zone = TZInfo::Timezone.get('UTC')
59
- else
60
- @time_zone = TZInfo::Timezone.get(@testrail_config[:tzinfoTimeZone])
61
- end
58
+ @time_zone = if @testrail_config[:tzinfoTimeZone].nil? || @testrail_config[:tzinfoTimeZone].empty?
59
+ TZInfo::Timezone.get('UTC')
60
+ else
61
+ TZInfo::Timezone.get(@testrail_config[:tzinfoTimeZone])
62
+ end
62
63
 
63
- if @testrail_config[:user].nil? || @testrail_config[:user].empty?
64
- @execute = false
65
- else
66
- @execute = true
67
- end
64
+ @execute = if @testrail_config[:user].nil? || @testrail_config[:user].empty?
65
+ false
66
+ else
67
+ true
68
+ end
68
69
 
69
70
  clear_results
70
71
  @submitted = { results: [] }
@@ -78,11 +79,11 @@ module Itriagetestrail
78
79
  end
79
80
 
80
81
  def config
81
- if ENV['TZINFO_TIME_ZONE'].nil? || ENV['TZINFO_TIME_ZONE'].empty?
82
- time_zone = 'America/Denver'
83
- else
84
- time_zone = ENV['TZINFO_TIME_ZONE']
85
- end
82
+ time_zone = if ENV['TZINFO_TIME_ZONE'].nil? || ENV['TZINFO_TIME_ZONE'].empty?
83
+ 'America/Denver'
84
+ else
85
+ ENV['TZINFO_TIME_ZONE']
86
+ end
86
87
 
87
88
  @testrail_config = {
88
89
  site: ENV['TESTRAIL_SITE'],
@@ -103,8 +104,7 @@ module Itriagetestrail
103
104
  androidDevice: ENV['DEVICE_NAME'],
104
105
  browser: ENV['BROWSER_NAME'], # Jenkins: SELENIUM_BROWSER
105
106
  platform: ENV['PLATFORM'], # Jenkins: SELENIUM_PLATFORM
106
- browserVersion: ENV['BROWSER_VERSION'] # Jenkins: SELENIUM_VERSION
107
- }
107
+ browserVersion: ENV['BROWSER_VERSION'] } # Jenkins: SELENIUM_VERSION
108
108
  }
109
109
  end
110
110
 
@@ -113,14 +113,14 @@ module Itriagetestrail
113
113
  tag_ids = []
114
114
  tag_names.each do |tag_name|
115
115
  case tag_name
116
- when '@wip'
117
- tag_ids << 1
118
- when '@flaky'
119
- tag_ids << 2
120
- when '@broken'
121
- tag_ids << 3
122
- when '@missingTheSauce'
123
- tag_ids << 4
116
+ when '@wip'
117
+ tag_ids << 1
118
+ when '@flaky'
119
+ tag_ids << 2
120
+ when '@broken'
121
+ tag_ids << 3
122
+ when '@missingTheSauce'
123
+ tag_ids << 4
124
124
  end
125
125
  end
126
126
  tag_ids
@@ -146,7 +146,7 @@ module Itriagetestrail
146
146
 
147
147
  reset_milestone(@milestone_name)
148
148
 
149
- if configuration_ids.size > 0 && false # disable configurations for now
149
+ if !configuration_ids.empty? && false # disable configurations for now
150
150
  add_testrail_plan if @plan_id == 0
151
151
  add_plan_entry if @run_id == 0
152
152
  else
@@ -186,9 +186,7 @@ module Itriagetestrail
186
186
  @client.password = @testrail_config[:password]
187
187
  end
188
188
 
189
-
190
-
191
- def close_run?()
189
+ def close_run?
192
190
  # do not close a run if a run id was supplied. other test suites related to the job will need it.
193
191
  close_run = false
194
192
  if @testrail_config[:close_run] == 'true' && (@testrail_config[:run_id].nil? || @testrail_config[:run_id] == '')
@@ -205,28 +203,26 @@ module Itriagetestrail
205
203
 
206
204
  # This method is only used publicly
207
205
  def initialize_temp_files
208
- Dir.mkdir('./tmp') unless File.exists?('./tmp')
206
+ Dir.mkdir('./tmp') unless File.exist?('./tmp')
209
207
  File.write(run_tempfile_name, @run_id.to_s)
210
208
  File.write(plan_tempfile_name, @plan_id.to_s)
211
209
 
212
210
  @shared_run = true
213
211
  end
214
212
 
215
- def close_run(run_id = @run_id, message='')
213
+ def close_run(run_id = @run_id, message = '')
216
214
  @client.send_post("update_run/#{run_id}",
217
- {include_all: false, case_ids: existing_cases_from_run(run_id),
218
- description: 'Timestamp: ' + @time_zone.now.strftime('%m/%d/%Y %I:%M %p') +
219
- ("\nBranch: #{@testrail_config[:origin]}") + "\n#{message}"})
215
+ include_all: false, case_ids: existing_cases_from_run(run_id),
216
+ description: 'Timestamp: ' + @time_zone.now.strftime('%m/%d/%Y %I:%M %p') +
217
+ "\nBranch: #{@testrail_config[:origin]}" + "\n#{message}")
220
218
 
221
219
  @client.send_post("close_run/#{run_id}", {})
222
220
  end
223
221
 
224
- def shutdown(message='')
222
+ def shutdown(message = '')
225
223
  @pool.shutdown
226
224
 
227
225
  close_run(message) if close_run?
228
226
  end
229
227
  end
230
228
  end
231
-
232
-
@@ -1,30 +1,31 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'itriagetestrail'
2
4
  module Itriagetestrail
3
5
  class TRCucumber13 < TestRailInterface
4
-
5
6
  def record_result(scenario)
6
7
  return if execute == false
7
8
  begin
8
9
  if scenario.class.to_s == 'Cucumber::Ast::OutlineTable::ExampleRow'
9
10
  scenario_cell_id = []
10
- scenario.name.split('|')[1..50].each {|cell| scenario_cell_id << cell.gsub(/[\| "]/, "") }
11
+ scenario.name.split('|')[1..50].each { |cell| scenario_cell_id << cell.gsub(/[\| "]/, '') }
11
12
  @scenario_title = "#{scenario.scenario_outline.title}, Example: #{scenario_cell_id}"
12
- @external_id = "#{scenario.scenario_outline.feature.name};#{@scenario_title}"[0,249]
13
- @scenario_steps = scenario.scenario_outline.raw_steps.select{'name'}.collect { |name| name.name }.join("\n")
13
+ @external_id = "#{scenario.scenario_outline.feature.name};#{@scenario_title}"[0, 249]
14
+ @scenario_steps = scenario.scenario_outline.raw_steps.select { 'name' }.collect(&:name).join("\n")
14
15
  else
15
16
  # identifiers: scenario.feature.name, scenario.name
16
17
  @external_id = "#{scenario.feature.title};#{scenario.title}"
17
18
  @scenario_title = scenario.title
18
- @scenario_steps = scenario.steps.select{'name'}.collect { |name| name.name }.join("\n")
19
+ @scenario_steps = scenario.steps.select { 'name' }.collect(&:name).join("\n")
19
20
  end
20
21
 
21
22
  if scenario.passed?
22
23
  store_result(@scenario_title, @external_id, @scenario_steps, 1, '')
23
24
  else
24
25
  store_result(@scenario_title, @external_id, @scenario_steps,
25
- "#{ENV['RERUN'] ? 5 : 4}".to_i, "#{scenario.exception.class}\n#{scenario.exception}\n#{scenario.exception.backtrace}")
26
+ (ENV['RERUN'] ? 5 : 4).to_s.to_i, "#{scenario.exception.class}\n#{scenario.exception}\n#{scenario.exception.backtrace}")
26
27
  end
27
- rescue => exception
28
+ rescue StandardError => exception
28
29
  puts "TESTRAIL ENCOUNTERED AN ERROR: #{exception}\n #{@external_id} \n\n"
29
30
  end
30
31
  end
@@ -1,28 +1,29 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'itriagetestrail'
2
4
  module Itriagetestrail
3
5
  class TRCucumber20 < TestRailInterface
4
-
5
6
  def record_result(scenario)
6
7
  return if execute == false
7
8
  begin
8
9
  if scenario.class.to_s == 'Cucumber::RunningTestCase::ScenarioOutlineExample'
9
- scenario.cell_values.each {|cell| cell.gsub!(/\s+/, "")}
10
+ scenario.cell_values.each { |cell| cell.gsub!(/\s+/, '') }
10
11
  @scenario_title = "#{scenario.name.match(/\b.*Example/)}: #{scenario.cell_values}"
11
- @external_id = "#{scenario.feature.short_name}\;#{@scenario_title}"[0,249]
12
+ @external_id = "#{scenario.feature.short_name}\;#{@scenario_title}"[0, 249]
12
13
  else
13
14
  @external_id = "#{scenario.feature.short_name}\;#{scenario.name}"
14
15
  @scenario_title = scenario.name
15
16
  end
16
17
 
17
- @scenario_steps = scenario.test_steps.select{'name'}.collect { |name| name.name }.join("\n")
18
+ @scenario_steps = scenario.test_steps.select { 'name' }.collect(&:name).join("\n")
18
19
 
19
20
  if scenario.passed?
20
21
  store_result(@scenario_title, @external_id, @scenario_steps, 1, '')
21
22
  else
22
23
  store_result(@scenario_title, @external_id, @scenario_steps,
23
- "#{ENV['RERUN'] ? 5 : 4}".to_i, "#{scenario.exception.class}\n#{scenario.exception}\n#{scenario.exception.backtrace}")
24
+ (ENV['RERUN'] ? 5 : 4).to_s.to_i, "#{scenario.exception.class}\n#{scenario.exception}\n#{scenario.exception.backtrace}")
24
25
  end
25
- rescue => exception
26
+ rescue StandardError => exception
26
27
  puts "TESTRAIL ENCOUNTERED AN ERROR: #{exception}\n #{@external_id} \n\n"
27
28
  end
28
29
  end
@@ -1,30 +1,31 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'itriagetestrail'
2
4
  module Itriagetestrail
3
5
  class TRCucumber30 < TestRailInterface
4
-
5
6
  def record_result(scenario)
6
7
  return if execute == false
7
8
  begin
8
9
  if scenario.class.to_s == 'Cucumber::RunningTestCase::ScenarioOutlineExample'
9
10
 
10
11
  # Remove spaces within cells to match our Cucumber 1.3 implementation
11
- scenario.cell_values.each {|cell| cell.gsub!(/\s+/, "")}
12
+ scenario.cell_values.each { |cell| cell.gsub!(/\s+/, '') }
12
13
  @scenario_title = "#{scenario.name.match(/\b.*Example/)}: #{scenario.cell_values}"
13
- @external_id = "#{scenario.feature.short_name}\;#{@scenario_title}"[0,249]
14
+ @external_id = "#{scenario.feature.short_name}\;#{@scenario_title}"[0, 249]
14
15
  else
15
16
  @external_id = "#{scenario.feature.short_name}\;#{scenario.name}"
16
17
  @scenario_title = scenario.name
17
18
  end
18
19
 
19
- @scenario_steps = scenario.test_steps.collect {|step| step.text }.join("\n")
20
+ @scenario_steps = scenario.test_steps.collect(&:text).join("\n")
20
21
 
21
22
  if scenario.passed?
22
23
  store_result(@scenario_title, @external_id, @scenario_steps, 1, '')
23
24
  else
24
25
  store_result(@scenario_title, @external_id, @scenario_steps,
25
- "#{ENV['RERUN'] ? 5 : 4}".to_i, "#{scenario.exception.class}\n#{scenario.exception}\n#{scenario.exception.backtrace}")
26
+ (ENV['RERUN'] ? 5 : 4).to_s.to_i, "#{scenario.exception.class}\n#{scenario.exception}\n#{scenario.exception.backtrace}")
26
27
  end
27
- rescue => exception
28
+ rescue StandardError => exception
28
29
  puts "TESTRAIL ENCOUNTERED AN ERROR: #{exception}\n #{@external_id} \n\n"
29
30
  end
30
31
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'itriagetestrail'
2
4
  module Itriagetestrail
3
5
  class TRMiniTest < TestRailInterface
@@ -12,7 +14,7 @@ module Itriagetestrail
12
14
  else
13
15
  store_result(test.name, @external_id, '', 5, failures.inspect)
14
16
  end
15
- rescue => exception
17
+ rescue StandardError => exception
16
18
  puts "TESTRAIL ENCOUNTERED AN ERROR: #{exception}\n #{@external_id} \n\n"
17
19
  end
18
20
  end
@@ -1,4 +1,4 @@
1
- require 'thread'
1
+ # frozen_string_literal: true
2
2
 
3
3
  class Pool
4
4
  def initialize(size)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #
2
4
  # TestRail API binding for Ruby (API v2, available since TestRail 3.0)
3
5
  #
@@ -73,6 +75,7 @@ module TestRail
73
75
  end
74
76
 
75
77
  private
78
+
76
79
  def _send_request(method, uri, data)
77
80
  url = URI.parse(@url + uri)
78
81
  if method == 'POST'
@@ -87,7 +90,7 @@ module TestRail
87
90
  conn = make_connection(url)
88
91
 
89
92
  retry_count = 0
90
- while retry_count < 10 do
93
+ while retry_count < 10
91
94
  response = conn.request(request)
92
95
  response_code = response.code
93
96
  if response_code == '429'
@@ -102,20 +105,19 @@ module TestRail
102
105
  retry_count += 1
103
106
  end
104
107
 
105
- if response.body && !response.body.empty?
106
- result = JSON.parse(response.body)
107
- else
108
- result = {}
109
- end
108
+ result = if response.body && !response.body.empty?
109
+ JSON.parse(response.body)
110
+ else
111
+ {}
112
+ end
110
113
 
111
114
  if response.code != '200'
112
- if result && result.key?('error')
113
- error = '"' + result['error'] + '"'
114
- else
115
- error = 'No additional error message received'
116
- end
117
- raise APIError.new('TestRail API returned HTTP %s (%s)' %
118
- [response.code, error])
115
+ error = if result&.key?('error')
116
+ '"' + result['error'] + '"'
117
+ else
118
+ 'No additional error message received'
119
+ end
120
+ raise APIError, format('TestRail API returned HTTP %s (%s)', response.code, error)
119
121
  end
120
122
 
121
123
  result
@@ -4,7 +4,6 @@ require 'tzinfo'
4
4
 
5
5
  module Itriagetestrail
6
6
  module Milestones
7
-
8
7
  # Establish the milestone name based on origin passed in,
9
8
  # usually origin represents a branch or environment
10
9
  def normalize_milestone
@@ -112,7 +111,7 @@ module Itriagetestrail
112
111
 
113
112
  # testrail call to rename a milestone (for archiving)
114
113
  def rename_milestone(id, new_name)
115
- # todo: rename milestone with previous_milestone
114
+ # TODO: rename milestone with previous_milestone
116
115
  body = { name: new_name }
117
116
  res = @client.send_post("update_milestone/#{id}", body)['id']
118
117
  end
@@ -120,7 +119,7 @@ module Itriagetestrail
120
119
  # this archives a milestone at the turn of a quarter and creates a new one in its place
121
120
  def reset_milestone(milestone_name)
122
121
  runs = milestone_runs(milestone_name)
123
- if runs.size > 0
122
+ unless runs.empty?
124
123
  last_run_time = Time.at(runs.last['completed_on'])
125
124
  if last_run_time < milestone_period_start
126
125
  rename_milestone(@milestone_id, milestone_archive_name(milestone_name, last_run_time))
@@ -129,4 +128,4 @@ module Itriagetestrail
129
128
  end
130
129
  end
131
130
  end
132
- end
131
+ end
@@ -5,7 +5,7 @@ module Itriagetestrail
5
5
  # TestRail Sections
6
6
  def testrail_sections
7
7
  case @suite_mode
8
- when 2,3
8
+ when 2, 3
9
9
  @suite_id = testrail_suite_id(@suite_name)
10
10
  @sections = @client.send_get("get_sections/#{@project_id}&suite_id=#{@suite_id}")
11
11
  else
@@ -22,16 +22,16 @@ module Itriagetestrail
22
22
  end
23
23
 
24
24
  def add_testrail_section(section_title)
25
- if @suite_name
26
- body = {
27
- name: section_title,
28
- suite_id: testrail_suite_id(@suite_name)
29
- }
30
- else
31
- body = {
32
- name: section_title
33
- }
34
- end
25
+ body = if @suite_name
26
+ {
27
+ name: section_title,
28
+ suite_id: testrail_suite_id(@suite_name)
29
+ }
30
+ else
31
+ {
32
+ name: section_title
33
+ }
34
+ end
35
35
 
36
36
  res = @client.send_post("add_section/#{@project_id}", body)
37
37
 
@@ -43,4 +43,4 @@ module Itriagetestrail
43
43
  testrail_section
44
44
  end
45
45
  end
46
- end
46
+ end
@@ -5,7 +5,7 @@ module Itriagetestrail
5
5
  # TestRail Suites
6
6
  def testrail_suites
7
7
  case @suite_mode
8
- when 2,3
8
+ when 2, 3
9
9
  @suites = @client.send_get("get_suites/#{@project_id}")
10
10
  end
11
11
  end
@@ -23,10 +23,10 @@ module Itriagetestrail
23
23
  res = @client.send_post("add_suite/#{@project_id}", body)
24
24
  testrail_suite = res['id']
25
25
 
26
- #re-establish suites
26
+ # re-establish suites
27
27
  testrail_suites
28
28
 
29
29
  testrail_suite
30
30
  end
31
31
  end
32
- end
32
+ end
@@ -5,7 +5,7 @@ module Itriagetestrail
5
5
  # TestRail Cases
6
6
  def testrail_ids
7
7
  case @suite_mode
8
- when 2,3
8
+ when 2, 3
9
9
  @test_cases = @client.send_get("get_cases/#{@project_id}&suite_id=#{@suite_id}&type_id=3")
10
10
  else
11
11
  @test_cases = @client.send_get("get_cases/#{@project_id}&type_id=3")
@@ -19,9 +19,7 @@ module Itriagetestrail
19
19
  def testrail_test_case_id(external_id)
20
20
  res = -1
21
21
  @test_cases.each do |test_case|
22
- if test_case['custom_external_case_id'] == external_id
23
- res = test_case['id']
24
- end
22
+ res = test_case['id'] if test_case['custom_external_case_id'] == external_id
25
23
  end
26
24
  res
27
25
  end
@@ -40,10 +38,10 @@ module Itriagetestrail
40
38
  # add the test case if it doesn't exist
41
39
  def add_testrail_test_case(scenario_title, external_id, scenario_steps, section_id)
42
40
  body = {
43
- title: scenario_title,
44
- custom_external_case_id: external_id,
45
- custom_steps: scenario_steps,
46
- type_id: 3
41
+ title: scenario_title,
42
+ custom_external_case_id: external_id,
43
+ custom_steps: scenario_steps,
44
+ type_id: 3
47
45
  }
48
46
 
49
47
  @client.send_post("add_case/#{section_id}", body)
@@ -76,4 +74,4 @@ module Itriagetestrail
76
74
  end
77
75
  end
78
76
  end
79
- end
77
+ end
@@ -2,7 +2,6 @@
2
2
 
3
3
  module Itriagetestrail
4
4
  module TestPlans
5
-
6
5
  def configuration_group(name)
7
6
  res = {}
8
7
  @configurations.each do |config|
@@ -22,13 +21,11 @@ module Itriagetestrail
22
21
  res
23
22
  end
24
23
 
25
-
26
24
  def configurations
27
25
  @configurations = @client.send_get("get_configs/#{@project_id}")
28
26
  end
29
27
 
30
28
  def configuration_ids
31
-
32
29
  @configuration_ids = []
33
30
 
34
31
  # evaluate @testrail_comfig
@@ -46,47 +43,45 @@ module Itriagetestrail
46
43
  end
47
44
 
48
45
  def add_testrail_plan
49
-
50
46
  body = {
51
- name: test_name,
52
- description: '',
53
- milestone_id: @milestone_id
47
+ name: test_name,
48
+ description: '',
49
+ milestone_id: @milestone_id
54
50
  }
55
51
 
56
52
  @plan = @client.send_post("add_plan/#{@project_id}", body)
57
- # todo: replace debugging
53
+ # TODO: replace debugging
58
54
  puts @plan.inspect
59
55
 
60
56
  @plan_id = @plan['id']
61
- # todo: replace debugging
57
+ # TODO: replace debugging
62
58
  puts @plan_id.inspect
63
59
  end
64
60
 
65
61
  def add_plan_entry
66
-
67
- # todo: refactor redundant assignments of @suite_id
62
+ # TODO: refactor redundant assignments of @suite_id
68
63
  @suite_id = testrail_suite_id(@suite_name)
69
64
  body = {
70
- suite_id: @suite_id,
71
- # todo: replace hardcoded name
72
- name: 'replace this with config description',
73
- include_all: true,
74
- # todo: replace hardcoded config
75
- config_ids: configuration_ids,
76
- runs: [
77
- {
78
- include_all: true,
79
- config_ids: configuration_ids
80
- }
81
- ]
65
+ suite_id: @suite_id,
66
+ # TODO: replace hardcoded name
67
+ name: 'replace this with config description',
68
+ include_all: true,
69
+ # TODO: replace hardcoded config
70
+ config_ids: configuration_ids,
71
+ runs: [
72
+ {
73
+ include_all: true,
74
+ config_ids: configuration_ids
75
+ }
76
+ ]
82
77
  }
83
78
 
84
79
  @plan_entry = @client.send_post("add_plan_entry/#{@plan_id}", body)
85
- # todo: replace debugging
80
+ # TODO: replace debugging
86
81
  puts @plan_entry.inspect
87
82
  @run_id = @plan_entry['runs'][0]['id']
88
- # todo: replace debugging
83
+ # TODO: replace debugging
89
84
  puts @run_id.inspect
90
85
  end
91
86
  end
92
- end
87
+ end
@@ -3,7 +3,7 @@
3
3
  module Itriagetestrail
4
4
  module TestResults
5
5
  def send_results_to_testrail
6
- return unless @results[:results].size != 0
6
+ return if @results[:results].empty?
7
7
  # copy what is in the results
8
8
  @submitted[:results] << @results[:results]
9
9
 
@@ -39,14 +39,14 @@ module Itriagetestrail
39
39
 
40
40
  case_id = testrail_test_case_id(external_id)
41
41
  @results[:results] << {
42
- case_id: case_id,
43
- scenario_title: scenario_title,
44
- external_id: external_id,
45
- scenario_steps: scenario_steps,
46
- status_id: status_id,
47
- comment: comment,
48
- custom_branch_name: @testrail_config[:origin]
42
+ case_id: case_id,
43
+ scenario_title: scenario_title,
44
+ external_id: external_id,
45
+ scenario_steps: scenario_steps,
46
+ status_id: status_id,
47
+ comment: comment,
48
+ custom_branch_name: @testrail_config[:origin]
49
49
  }
50
50
  end
51
51
  end
52
- end
52
+ end
@@ -11,20 +11,17 @@ module Itriagetestrail
11
11
  def existing_cases_from_description
12
12
  # Grabs from testrail run description
13
13
  run = @client.send_get("get_run/#{@run_id}")
14
- @description = run["description"]
15
- @description.nil? ? [] : @description.split(",")
14
+ @description = run['description']
15
+ @description.nil? ? [] : @description.split(',')
16
16
  end
17
17
 
18
18
  def existing_cases_from_run(run_id = @run_id)
19
-
20
19
  tests = @client.send_get("get_tests/#{run_id}&status_id=1,2,4,5") || []
21
20
 
22
21
  cases = []
23
22
 
24
23
  tests.each do |test|
25
-
26
- cases << test["case_id"]
27
-
24
+ cases << test['case_id']
28
25
  end
29
26
  cases
30
27
  end
@@ -32,10 +29,10 @@ module Itriagetestrail
32
29
  # open a test run to submit test results
33
30
  def add_testrail_run
34
31
  body = {
35
- name: test_name,
36
- description: '',
37
- include_all: true,
38
- milestone_id: @milestone_id
32
+ name: test_name,
33
+ description: '',
34
+ include_all: true,
35
+ milestone_id: @milestone_id
39
36
  }
40
37
 
41
38
  unless @testrail_config[:include_all] || true
@@ -44,11 +41,11 @@ module Itriagetestrail
44
41
  end
45
42
 
46
43
  case @suite_mode
47
- when 2,3
44
+ when 2, 3
48
45
  body[:suite_id] = @suite_id
49
46
  end
50
47
  res = @client.send_post("add_run/#{@project_id}", body)
51
48
  @run_id = res['id']
52
49
  end
53
50
  end
54
- end
51
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Itriagetestrail
2
- VERSION = '1.0.4'
4
+ VERSION = '1.0.5'
3
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itriagetestrail
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - a801069
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-02 00:00:00.000000000 Z
11
+ date: 2018-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tzinfo