testrail-cucumber 0.1.8 → 0.1.9
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/testrail-cucumber/update-testrails.rb +36 -0
- data/lib/testrail-cucumber/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c364f8ec7e6d8546b686fce3bcb6363e2102616c74dba9445c5168541631af7a
|
4
|
+
data.tar.gz: 329e4e2692a1c9430b5a2bb68733514eae307b9efe8bfba75160a3e5103b8d45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f452928d684e5c677d54263403bd93de7556d1e9d8a61896fb106e45584fad1339ec3b5403161adfe6480395a86af28b7df985358bd34646221964e37120546f
|
7
|
+
data.tar.gz: 0e09fef2a92beaf30fede7defcb68d406fe23742e27fc67a45ff86c43d1179002bdc2fa302e0b08751d066f7b910b3c8fcd6a9ed9eac46c9dbea6708f8595d13
|
@@ -15,6 +15,7 @@ module TestrailCucumber
|
|
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
|
@@ -36,6 +37,7 @@ module TestrailCucumber
|
|
36
37
|
@run_id = @@run_id = client.create_test_run("add_run/#{@config['project_id']}", { "suite_id": @config['suite_id']}) if @run_id.nil?
|
37
38
|
|
38
39
|
case_list.map do |case_id|
|
40
|
+
check_avail(:case_id, case_id)
|
39
41
|
response = client.send_post(
|
40
42
|
"add_result_for_case/#{@run_id}/#{case_id}",
|
41
43
|
{ status_id: status_id }
|
@@ -56,6 +58,17 @@ module TestrailCucumber
|
|
56
58
|
@client.user = @config['user']
|
57
59
|
@client.password = @config['password']
|
58
60
|
end
|
61
|
+
|
62
|
+
def config_validator
|
63
|
+
config_hash = {:project_id => @config['project_id'], :suite_id => @config['suite_id'], :run_id => @config['run_id']}
|
64
|
+
config_hash.map do |key, value|
|
65
|
+
next if value.nil?
|
66
|
+
check_avail(key, value)
|
67
|
+
end
|
68
|
+
|
69
|
+
cleaner if [@config['project_id'], @config['clean_testrun'], @config['run_id'].nil?].all?
|
70
|
+
$config_validator = true
|
71
|
+
end
|
59
72
|
|
60
73
|
def get_status_id(status)
|
61
74
|
case status
|
@@ -75,5 +88,28 @@ module TestrailCucumber
|
|
75
88
|
raise 'unexpected scenario status passed'
|
76
89
|
end
|
77
90
|
end
|
91
|
+
|
92
|
+
def cleaner
|
93
|
+
test_run_list = client.send_get("get_runs/#{@config['project_id']}")
|
94
|
+
test_run_list.map do |list|
|
95
|
+
client.send_post("delete_run/#{list['id']}", {"suite_id": @config['suite_id']})
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def check_avail(label, id)
|
100
|
+
case label
|
101
|
+
when :project_id
|
102
|
+
warn("\n###################### \ninvalid #project_id: #{id} \n######################") if client.send_get("get_project/#{id}").nil? || client.send_get("get_project/#{id}")['error'] != nil
|
103
|
+
when :suite_id
|
104
|
+
warn("\n###################### \ninvalid #suite_id: #{id} \n######################") if client.send_get("get_suite/#{id}").nil? || client.send_get("get_suite/#{id}")['error'] != nil
|
105
|
+
when :run_id
|
106
|
+
warn("\n###################### \ninvalid #run_id: #{id} \n######################") if client.send_get("get_run/#{id}").nil? || client.send_get("get_run/#{id}")['error'] != nil
|
107
|
+
when :case_id
|
108
|
+
return if client.send_get("get_case/#{id}").class == Integer
|
109
|
+
warn("\n###################### \ninvalid #case_id: #{id} \n######################") if client.send_get("get_case/#{id}").nil? || client.send_get("get_case/#{id}")['error'] != nil
|
110
|
+
else
|
111
|
+
p "no config available"
|
112
|
+
end
|
113
|
+
end
|
78
114
|
end
|
79
115
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: testrail-cucumber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
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-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -130,5 +130,6 @@ requirements: []
|
|
130
130
|
rubygems_version: 3.0.4
|
131
131
|
signing_key:
|
132
132
|
specification_version: 4
|
133
|
-
summary: Sync cucumber automation test results with your testrail suite
|
133
|
+
summary: Sync cucumber automation test results with your testrail suite. Discover
|
134
|
+
an example with Cucumber in this gem source.
|
134
135
|
test_files: []
|