cukerail 0.3.4 → 0.3.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 +4 -4
- data/lib/cukerail/version.rb +1 -1
- data/lib/cukerail.rb +23 -12
- data/lib/json_sender.rb +24 -23
- 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: 7ca72a855beaf0eb171de4e43366674b7f75c5ad
|
4
|
+
data.tar.gz: 668ef187633fa78bd9d8b60dcad7faaa172def22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4765e49ccbb33919ddec291081222f2692c193573e9473f2a72c6438264d399b74d0c30229f70cca29cf0b5cc8d79b23c187eb003ebaa0a72f83646313895141
|
7
|
+
data.tar.gz: fcabc83b418036dd731736aca67d65cb9146a3fd4c7ccdbdcdc5b7cadc13daf8ef2d28f11822098b16ac67485f80f320a88d08f95c97c87e45be6d4a19364091
|
data/lib/cukerail/version.rb
CHANGED
data/lib/cukerail.rb
CHANGED
@@ -20,7 +20,7 @@ module Cukerail
|
|
20
20
|
raise 'No id found' unless @id
|
21
21
|
send_steps(test_case,@id)
|
22
22
|
if ENV['TESTRUN']
|
23
|
-
send_result(test_case,result,@id,ENV['TESTRUN'])
|
23
|
+
send_result(test_case,result,@id,ENV['TESTRUN'].to_i)
|
24
24
|
end
|
25
25
|
rescue StandardError => e
|
26
26
|
puts "#{e.message} in #{extract_title(test_case)}"
|
@@ -189,28 +189,39 @@ module Cukerail
|
|
189
189
|
all_tags(test_case).select{|tag| tag.name =~/jira_/}.map{|ticket| /jira_(\w+-\d+)$/.match(ticket.name)[1]}.join(" ")
|
190
190
|
end
|
191
191
|
|
192
|
-
def update_run(
|
192
|
+
def update_run(run_id,case_ids)
|
193
|
+
run = get_run(run_id)
|
193
194
|
begin
|
194
|
-
|
195
|
+
if run['plan_id']
|
196
|
+
update_plan(run['plan_id'],run_id,case_ids)
|
197
|
+
else
|
198
|
+
testrail_api_client.send_post("update_run/#{run_id}",case_ids)
|
199
|
+
end
|
195
200
|
rescue => e
|
196
|
-
puts "#{e.message} testrun=#{
|
201
|
+
puts "#{e.message} testrun=#{run_id} test case ids=#{case_ids}"
|
197
202
|
end
|
198
203
|
end
|
199
204
|
|
200
|
-
def
|
205
|
+
def update_plan(plan_id,run_id,case_ids)
|
206
|
+
test_plan = testrail_api_client.send_get("get_plan/#{plan_id}")
|
207
|
+
entry_id = test_plan['entries'].detect{|e| e['runs'].any?{|r| r['id']==run_id}}['id']
|
208
|
+
testrail_api_client.send_post("update_plan_entry/#{plan_id}/#{entry_id}",case_ids)
|
209
|
+
end
|
210
|
+
|
211
|
+
def remove_case_from_test_run(testcase,run_id)
|
201
212
|
testcase_id = get_id(testcase)
|
202
|
-
run = get_run(
|
213
|
+
run = get_run(run_id)
|
203
214
|
unless run['include_all']
|
204
|
-
case_ids = get_tests_in_a_run(
|
205
|
-
update_run(
|
215
|
+
case_ids = get_tests_in_a_run(run_id).map{|h| h['case_id']} - [testcase_id]
|
216
|
+
update_run(run_id,{'case_ids'=>case_ids})
|
206
217
|
end
|
207
218
|
end
|
208
219
|
|
209
|
-
def add_case_to_test_run(testcase_id,
|
210
|
-
run = get_run(
|
220
|
+
def add_case_to_test_run(testcase_id,run_id)
|
221
|
+
run = get_run(run_id)
|
211
222
|
unless run['include_all']
|
212
|
-
case_ids = get_tests_in_a_run(
|
213
|
-
update_run(
|
223
|
+
case_ids = get_tests_in_a_run(run_id).map{|h| h['case_id']} + [testcase_id]
|
224
|
+
update_run(run_id,{'case_ids'=>case_ids})
|
214
225
|
end
|
215
226
|
end
|
216
227
|
|
data/lib/json_sender.rb
CHANGED
@@ -3,6 +3,7 @@ require_relative "cukerail/testrail"
|
|
3
3
|
require 'json' unless JSON
|
4
4
|
require 'awesome_print'
|
5
5
|
module Cukerail
|
6
|
+
|
6
7
|
class JsonSender
|
7
8
|
attr_reader :testrail_api_client,:results
|
8
9
|
def initialize(json_file)
|
@@ -80,7 +81,7 @@ module Cukerail
|
|
80
81
|
end
|
81
82
|
end
|
82
83
|
|
83
|
-
def send_result(scenario,id,
|
84
|
+
def send_result(scenario,id,run_id)
|
84
85
|
error_line = scenario['steps'].select{|s| s['result']['status'] != 'passed'}.first
|
85
86
|
if error_line
|
86
87
|
#puts error_line['result']
|
@@ -106,13 +107,13 @@ module Cukerail
|
|
106
107
|
end
|
107
108
|
report_on_result = {status_id:testrail_status[:id],comment:failure_message,defects:defects(scenario)}
|
108
109
|
begin
|
109
|
-
testrail_api_client.send_post("add_result_for_case/#{
|
110
|
+
testrail_api_client.send_post("add_result_for_case/#{run_id}/#{id}",report_on_result)
|
110
111
|
rescue => e
|
111
112
|
if e.message =~ /No \(active\) test found for the run\/case combination/
|
112
|
-
add_case_to_test_run(id,
|
113
|
+
add_case_to_test_run(id,run_id)
|
113
114
|
retry
|
114
115
|
else
|
115
|
-
puts "#{e.message} testrun=#{
|
116
|
+
puts "#{e.message} testrun=#{run_id} test case id=#{id}"
|
116
117
|
end
|
117
118
|
end
|
118
119
|
end
|
@@ -125,47 +126,47 @@ module Cukerail
|
|
125
126
|
testrail_api_client.send_get("get_tests/#{run_id}")
|
126
127
|
end
|
127
128
|
|
128
|
-
def update_run(
|
129
|
-
run = get_run(
|
129
|
+
def update_run(run_id,case_ids)
|
130
|
+
run = get_run(run_id)
|
130
131
|
begin
|
131
132
|
if run['plan_id']
|
132
|
-
update_plan(run['plan_id'],
|
133
|
+
update_plan(run['plan_id'],run_id,case_ids)
|
133
134
|
else
|
134
|
-
testrail_api_client.send_post("update_run/#{
|
135
|
+
testrail_api_client.send_post("update_run/#{run_id}",case_ids)
|
135
136
|
end
|
136
137
|
rescue => e
|
137
|
-
puts "#{e.message} testrun=#{
|
138
|
+
puts "#{e.message} testrun=#{run_id} test case ids=#{case_ids}"
|
138
139
|
end
|
139
140
|
end
|
140
141
|
|
141
|
-
def update_plan(plan_id,
|
142
|
+
def update_plan(plan_id,run_id,case_ids)
|
142
143
|
test_plan = testrail_api_client.send_get("get_plan/#{plan_id}")
|
143
|
-
entry_id = test_plan['entries'].select{|e| e['runs'].any?{|r| r['id']==
|
144
|
+
entry_id = test_plan['entries'].select{|e| e['runs'].any?{|r| r['id']==run_id}}.first['id']
|
144
145
|
testrail_api_client.send_post("update_plan_entry/#{plan_id}/#{entry_id}",case_ids)
|
145
146
|
end
|
146
147
|
|
147
|
-
def remove_case_from_test_run(testcase,
|
148
|
+
def remove_case_from_test_run(testcase,run_id)
|
148
149
|
testcase_id = get_id(testcase)
|
149
|
-
run = get_run(
|
150
|
+
run = get_run(run_id)
|
150
151
|
unless run['include_all']
|
151
|
-
case_ids = get_tests_in_a_run(
|
152
|
-
update_run(
|
152
|
+
case_ids = get_tests_in_a_run(run_id).map{|h| h['case_id']} - [testcase_id]
|
153
|
+
update_run(run_id,{'case_ids'=>case_ids})
|
153
154
|
end
|
154
155
|
end
|
155
156
|
|
156
|
-
def add_case_to_test_run(testcase_id,
|
157
|
-
run = get_run(
|
157
|
+
def add_case_to_test_run(testcase_id,run_id)
|
158
|
+
run = get_run(run_id)
|
158
159
|
unless run['include_all']
|
159
|
-
case_ids = get_tests_in_a_run(
|
160
|
-
update_run(
|
160
|
+
case_ids = get_tests_in_a_run(run_id).map{|h| h['case_id']} + [testcase_id]
|
161
|
+
update_run(run_id,{'case_ids'=>case_ids})
|
161
162
|
end
|
162
163
|
end
|
163
164
|
|
164
|
-
def remove_all_except_these_cases_from_testrun(testcases,
|
165
|
-
run = get_run(
|
165
|
+
def remove_all_except_these_cases_from_testrun(testcases,run_id)
|
166
|
+
run = get_run(run_id)
|
166
167
|
unless run['include_all']
|
167
|
-
case_ids = get_tests_in_a_run(
|
168
|
-
update_run(
|
168
|
+
case_ids = get_tests_in_a_run(run_id).map{|h| h['case_id']} & testcases
|
169
|
+
update_run(run_id,{'case_ids'=>case_ids})
|
169
170
|
end
|
170
171
|
end
|
171
172
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cukerail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Small
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|