itriagetestrail 0.4.5 → 0.4.6

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: 9b86c0b80c4ba6e1b8f74d079b6fc50b9cd832ea
4
- data.tar.gz: c6960e8913b13ee53a4f46ec4c5b5e94ed476a28
3
+ metadata.gz: fe93dd19eb21c974745a7063d0609183b2054ef2
4
+ data.tar.gz: fc21bb9999c452b502978634ebca80d5a61a5838
5
5
  SHA512:
6
- metadata.gz: 701885a45848c448ac2e6376a0c4a83775a6218b0dd1cd09abf46e6e6b0a6d1fc75c07f3386f9422198ae02464d677f1484fa41d45781abf89d6b7de80400fc2
7
- data.tar.gz: 237958bb45ca7cbcb51eef48a37a3a0a9ad9a232dc945a0d36fe8dd9e9b109b179545f667bb556650374451022015f35b956f80d706389e425f6fdd892c2cf5e
6
+ metadata.gz: 71b7c47ef5acb435faf616f5ec2ec81f7591f677f0245b3b91e5df9e0d394b4ce524d7f9cfdbce3815bcc4695e836b85faf7538691b0d7c69696274944d7a0eb
7
+ data.tar.gz: 8f7f307f95f5b2f314afb9f6ed76e534e10b37aae6bfcc87875237a16d9218309b0e043c1775e81694d436139d681d14f4ea3b519f393806b24f97a56dc9c0f2
@@ -2,6 +2,7 @@ require_relative 'itriagetestrail/version'
2
2
  require_relative 'itriagetestrail/testrail_binding'
3
3
  require_relative 'itriagetestrail/pool'
4
4
  require 'tzinfo'
5
+ require 'pry'
5
6
 
6
7
  module Itriagetestrail
7
8
  class TestRailInterface
@@ -185,8 +186,8 @@ module Itriagetestrail
185
186
  # We need to add the milestone to TestRail
186
187
 
187
188
  body = {
188
- name: requested_milestone_name,
189
- due_on: milestone_due_date
189
+ name: requested_milestone_name,
190
+ due_on: milestone_due_date
190
191
  }
191
192
 
192
193
  res = @client.send_post("add_milestone/#{@project_id}", body)['id']
@@ -236,7 +237,7 @@ module Itriagetestrail
236
237
 
237
238
  def add_testrail_section(section_title)
238
239
  body = {
239
- name: section_title
240
+ name: section_title
240
241
  }
241
242
 
242
243
  res = @client.send_post("add_section/#{@project_id}", body)
@@ -282,10 +283,10 @@ module Itriagetestrail
282
283
  # add the test case if it doesn't exist
283
284
  def add_testrail_test_case(scenario_title, external_id, scenario_steps, section_id)
284
285
  body = {
285
- title: scenario_title,
286
- custom_external_case_id: external_id,
287
- custom_steps: scenario_steps,
288
- type_id: 3
286
+ title: scenario_title,
287
+ custom_external_case_id: external_id,
288
+ custom_steps: scenario_steps,
289
+ type_id: 3
289
290
  }
290
291
 
291
292
  @client.send_post("add_case/#{section_id}", body)
@@ -310,8 +311,10 @@ module Itriagetestrail
310
311
  end
311
312
 
312
313
  def existing_cases
313
- # Read only means to get a list of test cases from prior runs
314
- File.read('./tmp/testrail_ids').split(',')
314
+ # Grabs from testrail run description
315
+ run = @client.send_get("get_run/#{@run_id}")
316
+ @description = run["description"]
317
+ @description.nil? ? [] : @description.split(",")
315
318
  end
316
319
 
317
320
  # open a test run to submit test results
@@ -319,21 +322,19 @@ module Itriagetestrail
319
322
  if @testrail_config[:include_all] || true
320
323
 
321
324
  body = {
322
- name: test_name,
323
- description: 'Timestamp: ' + @time_zone.now.strftime('%m/%d/%Y %-I:%M %p') \
324
- + ("\nBranch: #{@testrail_config[:origin]}"),
325
- include_all: true,
326
- milestone_id: @milestone_id
325
+ name: test_name,
326
+ description: '',
327
+ include_all: true,
328
+ milestone_id: @milestone_id
327
329
  }
328
330
  else
329
331
 
330
332
  body = {
331
- name: test_name,
332
- description: 'Timestamp: ' + @time_zone.now.strftime('%m/%d/%Y %I:%M %p') \
333
- + ("\nBranch: #{@testrail_config[:origin]}"),
334
- include_all: false,
335
- case_ids: @test_case_ids,
336
- milestone_id: @milestone_id
333
+ name: test_name,
334
+ description: '',
335
+ include_all: false,
336
+ case_ids: @test_case_ids,
337
+ milestone_id: @milestone_id
337
338
  }
338
339
  end
339
340
 
@@ -378,26 +379,15 @@ module Itriagetestrail
378
379
 
379
380
  case_id = testrail_test_case_id(external_id)
380
381
  @results[:results] << {
381
- case_id: case_id,
382
- scenario_title: scenario_title,
383
- external_id: external_id,
384
- scenario_steps: scenario_steps,
385
- status_id: status_id,
386
- comment: comment
382
+ case_id: case_id,
383
+ scenario_title: scenario_title,
384
+ external_id: external_id,
385
+ scenario_steps: scenario_steps,
386
+ status_id: status_id,
387
+ comment: comment
387
388
  }
388
389
  end
389
390
 
390
- def store_case_ids(list)
391
- new_list = []
392
- list.each { |item| new_list << item }
393
-
394
- f = File.open('./tmp/testrail_ids', 'r+')
395
- f.read.split(',').each{ |item| new_list << item.to_i}
396
- f.rewind
397
- f.write new_list.join(',')
398
- f.close
399
- end
400
-
401
391
  # this is the hack at very end to exclude tests which frameworks like MiniTest and Cucumber did not touch
402
392
  # including all tests at beginning is necessary so that at least some progress can be seen when
403
393
  # real time updating is enabled.
@@ -405,13 +395,10 @@ module Itriagetestrail
405
395
  executed_ids = []
406
396
  @results[:results].each {|id| executed_ids << id[:case_id]}
407
397
 
408
- # Save ids for more processes in this run
409
- store_case_ids(executed_ids) if @shared_run == true
410
-
411
- # If previous ids exist, retain them and their results
398
+ # Append case ids to description
412
399
  existing_cases.each { |case_id| executed_ids << case_id } if @shared_run == true
413
400
 
414
- send = {include_all: false, case_ids: executed_ids}
401
+ send = {include_all: false, case_ids: executed_ids.uniq, description: executed_ids.uniq.join(",")}
415
402
  @client.send_post("update_run/#{@run_id}", send)
416
403
  end
417
404
 
@@ -427,18 +414,19 @@ module Itriagetestrail
427
414
  # This method is only used publicly
428
415
  def delete_temp_files
429
416
  File.delete('./tmp/testrail_id') if File.exist?('./tmp/testrail_id')
430
- File.delete('./tmp/testrail_ids') if File.exist?('./tmp/testrail_ids')
431
417
  end
432
418
 
433
419
  # This method is only used publicly
434
420
  def initialize_temp_files
435
421
  Dir.mkdir('./tmp') unless File.exists?('./tmp')
436
422
  File.write('./tmp/testrail_id', @run_id.to_s)
437
- File.write('./tmp/testrail_ids', '')
423
+
438
424
  @shared_run = true
439
425
  end
440
426
 
441
427
  def close_run
428
+ @client.send_post("update_run/#{@run_id}", {description: 'Timestamp: ' + @time_zone.now.strftime('%m/%d/%Y %I:%M %p') \
429
+ + ("\nBranch: #{@testrail_config[:origin]}")})
442
430
  @client.send_post("close_run/#{@run_id}", {})
443
431
  end
444
432
 
@@ -1,3 +1,3 @@
1
1
  module Itriagetestrail
2
- VERSION = '0.4.5'
2
+ VERSION = '0.4.6'
3
3
  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: 0.4.5
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - a801069
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-13 00:00:00.000000000 Z
11
+ date: 2016-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler