itriagetestrail 0.8.3 → 0.8.4
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 +4 -4
- data/lib/itriagetestrail/version.rb +1 -1
- data/lib/itriagetestrail.rb +124 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6637c3cbe5789b8c5a8227f0bc5ce59d96db2bb
|
4
|
+
data.tar.gz: 70aff355789a94a59f90c4838a95f7cc9daa3b44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 551fcee66d22ff86fca5209be43ccfb118c08702c5e57f293b5f54cf38c8f3d53a18a73a2d2fe48c91e8926958a4a1ec716b7fc1d7fd5b4a325d671a39a52bd9
|
7
|
+
data.tar.gz: 1b8737fee7539ba3671bea83d565faaaf0916d2fb33e01a76fe2227010d71016651a01a3e7ae50e4acf0ac9b5c51bb440642b7cee88f31116206d644f11a8410
|
data/lib/itriagetestrail.rb
CHANGED
@@ -310,6 +310,95 @@ module Itriagetestrail
|
|
310
310
|
end
|
311
311
|
end
|
312
312
|
|
313
|
+
module TestPlans
|
314
|
+
|
315
|
+
def configuration_group(name)
|
316
|
+
res = {}
|
317
|
+
@configurations.each do |config|
|
318
|
+
res = config if config['name'] == name
|
319
|
+
end
|
320
|
+
res
|
321
|
+
end
|
322
|
+
|
323
|
+
def config_id(name, value)
|
324
|
+
res = {}
|
325
|
+
configuration = configuration_group(name)
|
326
|
+
|
327
|
+
return nil if configuration.empty?
|
328
|
+
configuration['configs'].each do |config|
|
329
|
+
res = config['id'] if config['name'] == value
|
330
|
+
end
|
331
|
+
res
|
332
|
+
end
|
333
|
+
|
334
|
+
|
335
|
+
def configurations
|
336
|
+
@configurations = @client.send_get("get_configs/#{@project_id}")
|
337
|
+
end
|
338
|
+
|
339
|
+
def configuration_ids
|
340
|
+
|
341
|
+
@configuration_ids = []
|
342
|
+
|
343
|
+
# evaluate @testrail_comfig
|
344
|
+
@configuration_ids << config_id('Browser', @testrail_config[:config][:browser])
|
345
|
+
@configuration_ids << config_id('Browser Version', @testrail_config[:config][:browserVersion])
|
346
|
+
@configuration_ids << config_id('Platform', @testrail_config[:config][:platform])
|
347
|
+
@configuration_ids << config_id('Android Version', @testrail_config[:config][:android])
|
348
|
+
@configuration_ids << config_id('Android Device', @testrail_config[:config][:androidDevice])
|
349
|
+
@configuration_ids << config_id('IOS Version', @testrail_config[:config][:ios])
|
350
|
+
|
351
|
+
# remove the nils
|
352
|
+
@configuration_ids.compact!
|
353
|
+
|
354
|
+
@configuration_ids
|
355
|
+
end
|
356
|
+
|
357
|
+
def add_testrail_plan
|
358
|
+
|
359
|
+
body = {
|
360
|
+
name: test_name,
|
361
|
+
description: '',
|
362
|
+
milestone_id: @milestone_id
|
363
|
+
}
|
364
|
+
|
365
|
+
@plan = @client.send_post("add_plan/#{@project_id}", body)
|
366
|
+
# todo: replace debugging
|
367
|
+
puts @plan.inspect
|
368
|
+
|
369
|
+
@plan_id = @plan['id']
|
370
|
+
# todo: replace debugging
|
371
|
+
puts @plan_id.inspect
|
372
|
+
end
|
373
|
+
|
374
|
+
def add_plan_entry
|
375
|
+
|
376
|
+
# todo: refactor redundant assignments of @suite_id
|
377
|
+
@suite_id = testrail_suite_id(@suite_name)
|
378
|
+
body = {
|
379
|
+
suite_id: @suite_id,
|
380
|
+
# todo: replace hardcoded name
|
381
|
+
name: 'replace this with config description',
|
382
|
+
include_all: true,
|
383
|
+
# todo: replace hardcoded config
|
384
|
+
config_ids: configuration_ids,
|
385
|
+
runs: [
|
386
|
+
{
|
387
|
+
include_all: true,
|
388
|
+
config_ids: configuration_ids
|
389
|
+
}
|
390
|
+
]
|
391
|
+
}
|
392
|
+
|
393
|
+
@plan_entry = @client.send_post("add_plan_entry/#{@plan_id}", body)
|
394
|
+
# todo: replace debugging
|
395
|
+
puts @plan_entry.inspect
|
396
|
+
@run_id = @plan_entry['runs'][0]['id']
|
397
|
+
# todo: replace debugging
|
398
|
+
puts @run_id.inspect
|
399
|
+
end
|
400
|
+
end
|
401
|
+
|
313
402
|
module TestRuns
|
314
403
|
def extend_testrail_run
|
315
404
|
# Reset test scope to include all cases
|
@@ -417,6 +506,7 @@ module Itriagetestrail
|
|
417
506
|
include Milestones
|
418
507
|
include Sections
|
419
508
|
include TestCases
|
509
|
+
include TestPlans
|
420
510
|
include TestRuns
|
421
511
|
include TestResults
|
422
512
|
|
@@ -435,11 +525,13 @@ module Itriagetestrail
|
|
435
525
|
@setup = false
|
436
526
|
config
|
437
527
|
|
438
|
-
if File.exist?(
|
439
|
-
@run_id = File.read(
|
528
|
+
if File.exist?(run_tempfile_name)
|
529
|
+
@run_id = File.read(run_tempfile_name)
|
530
|
+
@plan_id = File.read(plan_tempfile_name)
|
440
531
|
@shared_run = true
|
441
532
|
else
|
442
533
|
@run_id = 0
|
534
|
+
@plan_id = 0
|
443
535
|
end
|
444
536
|
|
445
537
|
@milestone_name = normalize_milestone
|
@@ -483,13 +575,21 @@ module Itriagetestrail
|
|
483
575
|
password: ENV['TESTRAIL_PASSWORD'],
|
484
576
|
tzinfoTimeZone: time_zone,
|
485
577
|
projectId: ENV['TESTRAIL_PROJECT_ID'],
|
578
|
+
masterMilestone: ENV['TESTRAIL_MASTER_MILESTONE'],
|
486
579
|
projectName: ENV['APP_NAME'],
|
487
580
|
suiteName: ENV['TESTRAIL_SUITE_NAME'],
|
488
581
|
run_id: ENV['TESTRAIL_RUN_ID'],
|
489
582
|
close_run: ENV['TESTRAIL_CLOSE_RUN'],
|
490
583
|
origin: ENV['GIT_BRANCH'],
|
491
584
|
jenkinsBuild: ENV['BUILD_NUMBER'],
|
492
|
-
appVersion: nil
|
585
|
+
appVersion: nil,
|
586
|
+
config: { ios: ENV['IOS_VERSION'],
|
587
|
+
android: ENV['ANDROID_VERSION'],
|
588
|
+
androidDevice: ENV['DEVICE_NAME'],
|
589
|
+
browser: ENV['BROWSER_NAME'], # Jenkins: SELENIUM_BROWSER
|
590
|
+
platform: ENV['PLATFORM'], # Jenkins: SELENIUM_PLATFORM
|
591
|
+
browserVersion: ENV['BROWSER_VERSION'] # Jenkins: SELENIUM_VERSION
|
592
|
+
}
|
493
593
|
}
|
494
594
|
end
|
495
595
|
|
@@ -531,10 +631,16 @@ module Itriagetestrail
|
|
531
631
|
|
532
632
|
reset_milestone(@milestone_name)
|
533
633
|
|
534
|
-
if
|
535
|
-
|
634
|
+
if configuration_ids.size > 0
|
635
|
+
add_testrail_plan if @plan_id == 0
|
636
|
+
add_plan_entry
|
536
637
|
else
|
537
|
-
|
638
|
+
if @run_id == 0
|
639
|
+
add_testrail_run
|
640
|
+
else
|
641
|
+
# this else may be obsolete
|
642
|
+
extend_testrail_run
|
643
|
+
end
|
538
644
|
end
|
539
645
|
|
540
646
|
@pool = Pool.new(1)
|
@@ -552,10 +658,16 @@ module Itriagetestrail
|
|
552
658
|
testrail_sections
|
553
659
|
# Get the test rail ids
|
554
660
|
testrail_ids
|
661
|
+
# Populate configurations
|
662
|
+
configurations
|
663
|
+
end
|
664
|
+
|
665
|
+
def run_tempfile_name
|
666
|
+
"./tmp/#{@testrail_config[:jenkinsBuild]}_testrail_run_id"
|
555
667
|
end
|
556
668
|
|
557
|
-
def
|
558
|
-
"./tmp/#{@testrail_config[:jenkinsBuild]}
|
669
|
+
def plan_tempfile_name
|
670
|
+
"./tmp/#{@testrail_config[:jenkinsBuild]}_testrail_plan_id"
|
559
671
|
end
|
560
672
|
|
561
673
|
def make_connection
|
@@ -577,13 +689,15 @@ module Itriagetestrail
|
|
577
689
|
|
578
690
|
# This method is only used publicly
|
579
691
|
def delete_temp_files
|
580
|
-
File.delete(
|
692
|
+
File.delete(run_tempfile_name) if File.exist?(run_tempfile_name)
|
693
|
+
File.delete(plan_tempfile_name) if File.exist?(plan_tempfile_name)
|
581
694
|
end
|
582
695
|
|
583
696
|
# This method is only used publicly
|
584
697
|
def initialize_temp_files
|
585
698
|
Dir.mkdir('./tmp') unless File.exists?('./tmp')
|
586
|
-
File.write(
|
699
|
+
File.write(run_tempfile_name, @run_id.to_s)
|
700
|
+
File.write(plan_tempfile_name, @plan_id.to_s)
|
587
701
|
|
588
702
|
@shared_run = true
|
589
703
|
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.8.
|
4
|
+
version: 0.8.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- a801069
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|