cukerail 0.3.3 → 0.3.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/cukerail/version.rb +1 -1
- data/lib/json_sender.rb +20 -13
- data/lib/tasks/cukerail.rake +2 -2
- 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: e5bafd2e3713f9bc90f2555a9f01581df6ae2420
|
4
|
+
data.tar.gz: 78579041ab618d9b636639c374e7493b8ba2c843
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e01b06f772ded6ed2cc164b83a3fd31540b2d515ab76c06fa909775879ad81cb7ac768a073fe3e4bf6603939aba58d437924121600345b0e442035bac1188243
|
7
|
+
data.tar.gz: 4de9899654fe18a1dfa0f4d12265001a57d36f55f722a8cc99813e6130b2208c30a15a39a066d07806815430e07b8d870741b1f309c0732a05697269da1ee58e
|
data/lib/cukerail/version.rb
CHANGED
data/lib/json_sender.rb
CHANGED
@@ -76,14 +76,14 @@ module Cukerail
|
|
76
76
|
|
77
77
|
def defects(scenario)
|
78
78
|
if scenario['tags']
|
79
|
-
scenario['tags'].select{|t| t['name'] =~/@jira_/}.map{|t| /jira_(\w+-\
|
79
|
+
scenario['tags'].select{|t| t['name'] =~/@jira_/}.map{|t| /jira_(\w+-\d+)/.match(t['name'])[1]}.join(' ')
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
-
def send_result(scenario,id,
|
83
|
+
def send_result(scenario,id,testrun_id)
|
84
84
|
error_line = scenario['steps'].select{|s| s['result']['status'] != 'passed'}.first
|
85
85
|
if error_line
|
86
|
-
puts error_line['result']
|
86
|
+
#puts error_line['result']
|
87
87
|
testrail_status = case error_line['result']['status']
|
88
88
|
when 'failed'
|
89
89
|
{id:5,comment: 'failed'}
|
@@ -106,37 +106,44 @@ module Cukerail
|
|
106
106
|
end
|
107
107
|
report_on_result = {status_id:testrail_status[:id],comment:failure_message,defects:defects(scenario)}
|
108
108
|
begin
|
109
|
-
testrail_api_client.send_post("add_result_for_case/#{
|
109
|
+
testrail_api_client.send_post("add_result_for_case/#{testrun_id}/#{id}",report_on_result)
|
110
110
|
rescue => e
|
111
111
|
if e.message =~ /No \(active\) test found for the run\/case combination/
|
112
|
-
add_case_to_test_run(id,
|
112
|
+
add_case_to_test_run(id,testrun_id)
|
113
113
|
retry
|
114
114
|
else
|
115
|
-
puts "#{e.message} testrun=#{
|
115
|
+
puts "#{e.message} testrun=#{testrun_id} test case id=#{id}"
|
116
116
|
end
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
120
120
|
def get_run(run_id)
|
121
|
-
|
122
|
-
ap @test_run
|
123
|
-
puts "test plan = #{@test_run['plan_id']}"
|
124
|
-
@test_run
|
121
|
+
testrail_api_client.send_get("get_run/#{run_id}")
|
125
122
|
end
|
126
123
|
|
127
124
|
def get_tests_in_a_run(run_id)
|
128
|
-
|
125
|
+
testrail_api_client.send_get("get_tests/#{run_id}")
|
129
126
|
end
|
130
127
|
|
131
128
|
def update_run(testrun_id,case_ids)
|
132
129
|
run = get_run(testrun_id)
|
133
130
|
begin
|
134
|
-
|
131
|
+
if run['plan_id']
|
132
|
+
update_plan(run['plan_id'],testrun_id,case_ids)
|
133
|
+
else
|
134
|
+
testrail_api_client.send_post("update_run/#{testrun_id}",case_ids)
|
135
|
+
end
|
135
136
|
rescue => e
|
136
137
|
puts "#{e.message} testrun=#{testrun_id} test case ids=#{case_ids}"
|
137
138
|
end
|
138
139
|
end
|
139
140
|
|
141
|
+
def update_plan(plan_id,testrun_id,case_ids)
|
142
|
+
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']==testrun_id}}.first['id']
|
144
|
+
testrail_api_client.send_post("update_plan_entry/#{plan_id}/#{entry_id}",case_ids)
|
145
|
+
end
|
146
|
+
|
140
147
|
def remove_case_from_test_run(testcase,testrun_id)
|
141
148
|
testcase_id = get_id(testcase)
|
142
149
|
run = get_run(testrun_id)
|
@@ -146,7 +153,7 @@ module Cukerail
|
|
146
153
|
end
|
147
154
|
end
|
148
155
|
|
149
|
-
def add_case_to_test_run(testcase_id,
|
156
|
+
def add_case_to_test_run(testcase_id,testrun_id)
|
150
157
|
run = get_run(testrun_id)
|
151
158
|
unless run['include_all']
|
152
159
|
case_ids = get_tests_in_a_run(testrun_id).map{|h| h['case_id']} + [testcase_id]
|
data/lib/tasks/cukerail.rake
CHANGED
@@ -30,7 +30,7 @@ task :load_to_test_run do
|
|
30
30
|
testcase_id = json_sender.get_id(scenario,background_steps,project_id,suite_id,sub_section_id)
|
31
31
|
puts "scenario_id #{scenario['id']} testcase_id = #{testcase_id}"
|
32
32
|
json_sender.send_steps(scenario,background_steps,testcase_id)
|
33
|
-
json_sender.send_result(scenario,testcase_id,ENV['TESTRUN'])
|
33
|
+
json_sender.send_result(scenario,testcase_id,ENV['TESTRUN'].to_i)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -46,7 +46,7 @@ task :remove_from_test_run do
|
|
46
46
|
testcase_ids << json_sender.get_id(scenario,background_steps,project_id,suite_id,sub_section_id)
|
47
47
|
end
|
48
48
|
end
|
49
|
-
json_sender.remove_all_except_these_cases_from_testrun(testcase_ids,ENV['TESTRUN'])
|
49
|
+
json_sender.remove_all_except_these_cases_from_testrun(testcase_ids,ENV['TESTRUN'].to_i)
|
50
50
|
end
|
51
51
|
|
52
52
|
desc "match test run cases to json results file"
|
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.4
|
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-01-
|
11
|
+
date: 2016-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|