testrail-rspec 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/testrail-rspec/update-testrails.rb +37 -2
- data/lib/testrail-rspec/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9490b35d242306d46791f6223e3725a384ddba101b447b99bc38509c9e7dbf7f
|
4
|
+
data.tar.gz: f16d170284957455c2210f0b73717c077e6cb9d915f2581122076e723ea683fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c250d0c4486039dc719ee88ae93ef9cb0b66b41975626f91783091841878c50ee10f7f051f6f363f4a6fdb436b4b940fa2f3d18149b24449ada37b9f1239ab79
|
7
|
+
data.tar.gz: 4ec7e26ef2eb551826aa1ee4365aa27e2ad9318da30fb66c00f97e551b11bdab387d8b3125181c2e312ee44f9b8796fee382983e29c02de33339af18e1a514b6
|
@@ -15,6 +15,7 @@ module TestrailRSpec
|
|
15
15
|
end
|
16
16
|
|
17
17
|
setup_testrail_client
|
18
|
+
config_validator if $config_validator.nil?
|
18
19
|
end
|
19
20
|
|
20
21
|
def upload_result
|
@@ -46,12 +47,13 @@ module TestrailRSpec
|
|
46
47
|
|
47
48
|
@run_id ||= @config['run_id']
|
48
49
|
@run_id = @@run_id rescue @@run_id = nil unless @config['run_id']
|
49
|
-
@run_id = @@run_id = client.create_test_run("add_run/#{@config['project_id']}", {
|
50
|
+
@run_id = @@run_id = client.create_test_run("add_run/#{@config['project_id']}", {"suite_id": @config['suite_id']}) if @run_id.nil?
|
50
51
|
|
51
52
|
case_list.map do |case_id|
|
53
|
+
check_avail(:case_id, case_id)
|
52
54
|
response = client.send_post(
|
53
55
|
"add_result_for_case/#{@run_id}/#{case_id}",
|
54
|
-
{
|
56
|
+
{status_id: status_id, comment: message}
|
55
57
|
)
|
56
58
|
end
|
57
59
|
|
@@ -70,6 +72,17 @@ module TestrailRSpec
|
|
70
72
|
@client.password = @config['password']
|
71
73
|
end
|
72
74
|
|
75
|
+
def config_validator
|
76
|
+
config_hash = {:project_id => @config['project_id'], :suite_id => @config['suite_id'], :run_id => @config['run_id']}
|
77
|
+
config_hash.map do |key, value|
|
78
|
+
next if value.nil?
|
79
|
+
check_avail(key, value)
|
80
|
+
end
|
81
|
+
|
82
|
+
cleaner if [@config['project_id'], @config['clean_testrun'], @config['run_id'].nil?].all?
|
83
|
+
$config_validator = true
|
84
|
+
end
|
85
|
+
|
73
86
|
def get_status_id(status)
|
74
87
|
case status
|
75
88
|
when :passed
|
@@ -88,5 +101,27 @@ module TestrailRSpec
|
|
88
101
|
raise 'unexpected scenario status passed'
|
89
102
|
end
|
90
103
|
end
|
104
|
+
|
105
|
+
def cleaner
|
106
|
+
test_run_list = client.send_get("get_runs/#{@config['project_id']}")
|
107
|
+
test_run_list.map do |list|
|
108
|
+
client.send_post("delete_run/#{list['id']}", {"suite_id": @config['suite_id']})
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def check_avail(label, id)
|
113
|
+
case label
|
114
|
+
when :project_id
|
115
|
+
warn("\n###################### \ninvalid #project_id: #{id} \n######################") if client.send_get("get_project/#{id}").nil?
|
116
|
+
when :suite_id
|
117
|
+
warn("\n###################### \ninvalid #suite_id: #{id} \n######################") if client.send_get("get_suite/#{id}").nil?
|
118
|
+
when :run_id
|
119
|
+
warn("\n###################### \ninvalid #run_id: #{id} \n######################") if client.send_get("get_run/#{id}").nil?
|
120
|
+
when :case_id
|
121
|
+
warn("\n###################### \ninvalid #case_id: #{id} \n######################") if client.send_get("get_case/#{id}").nil?
|
122
|
+
else
|
123
|
+
p "no config available"
|
124
|
+
end
|
125
|
+
end
|
91
126
|
end
|
92
127
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: testrail-rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Prashanth Sams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|