test_rail_integration 0.0.9 → 0.0.9.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 358ef63f7961598a1e416d4b51df3b73b1c80b50
|
4
|
+
data.tar.gz: 4c7f618f6398977f3b6095018ac569344789f834
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbbda4abe090101224b3b8cef74355b4663d6a84aae974bd20cd458218c93eb644934e70184909d4bd27c266979a9725c9e7e65b3478b2b4f19cdde8153475b2
|
7
|
+
data.tar.gz: 97eeab62fc159b2353b2a864c1fe2cb84ca2cb5770dc00412e5d9bfc85d8650c97d2865ee3511d8841ea9d6fbd1a12d75a2664705eed513f8a36c2b8d1e8af1c
|
@@ -46,7 +46,8 @@ class CLI < Thor
|
|
46
46
|
--showroom with showroom name where start tests,
|
47
47
|
--command with new command,
|
48
48
|
--auto for getting env, venture params from test run name,
|
49
|
-
--simple for run without venture and env params
|
49
|
+
--simple for run without venture and env params,
|
50
|
+
--type to define tests with type to execute."
|
50
51
|
option :test_run_id
|
51
52
|
option :venture
|
52
53
|
option :showroom
|
@@ -54,6 +55,7 @@ class CLI < Thor
|
|
54
55
|
option :env
|
55
56
|
option :auto
|
56
57
|
option :simple
|
58
|
+
option :type
|
57
59
|
def shoot
|
58
60
|
if options[:test_run_id]
|
59
61
|
test_run_id = options[:test_run_id]
|
@@ -110,6 +112,9 @@ class CLI < Thor
|
|
110
112
|
else
|
111
113
|
command.command = TestRunParameters::EXEC_COMMAND
|
112
114
|
end
|
115
|
+
if options[:type]
|
116
|
+
command.type = options[:type].to_i
|
117
|
+
end
|
113
118
|
command.generate
|
114
119
|
command.execute
|
115
120
|
else
|
@@ -5,10 +5,12 @@ module TestRail
|
|
5
5
|
attr_accessor :command,
|
6
6
|
:tags,
|
7
7
|
:venture,
|
8
|
-
:env
|
8
|
+
:env,
|
9
|
+
:type,
|
10
|
+
:id
|
9
11
|
|
10
12
|
def initialize(id_of_run)
|
11
|
-
self.
|
13
|
+
self.id = id_of_run
|
12
14
|
end
|
13
15
|
|
14
16
|
def execute
|
@@ -19,14 +21,20 @@ module TestRail
|
|
19
21
|
def generate
|
20
22
|
#TODO do smth with weird replacement
|
21
23
|
if venture.nil? || env.nil?
|
22
|
-
self.command = self.command + " " +
|
24
|
+
self.command = self.command + " " + get_tags
|
23
25
|
else
|
24
|
-
self.command = self.command.gsub("\#{parameters.venture}", self.venture).gsub("\#{parameters.environment}", self.env) + " " +
|
26
|
+
self.command = self.command.gsub("\#{parameters.venture}", self.venture).gsub("\#{parameters.environment}", self.env) + " " + get_tags
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
28
|
-
def get_tags
|
29
|
-
|
30
|
+
def get_tags
|
31
|
+
cases = nil
|
32
|
+
if type.nil?
|
33
|
+
cases = Connection.cases_ids_by_default(self.id)
|
34
|
+
else
|
35
|
+
cases = Connection.cases_ids_by_type(self.id, self.type)
|
36
|
+
end
|
37
|
+
cases.map { |id| "@C"+id.to_s }.join(",")
|
30
38
|
end
|
31
39
|
|
32
40
|
def self.execute_command(command)
|
@@ -54,9 +54,18 @@ module TestRail
|
|
54
54
|
#
|
55
55
|
# cases = client.send_get("get_tests/12")
|
56
56
|
#
|
57
|
-
def self.
|
58
|
-
|
59
|
-
|
57
|
+
def self.cases_by_default(test_run_id)
|
58
|
+
client.send_get("get_tests/#{test_run_id}")
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.cases_ids_by_default(test_run_id)
|
62
|
+
cases = cases_by_default(test_run_id)
|
63
|
+
cases.map { |test_case| test_case["case_id"]}
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.cases_ids_by_type(test_run_id, type)
|
67
|
+
cases = cases_by_default(test_run_id)
|
68
|
+
cases.map { |test_case| test_case["case_id"] if test_case["type_id"].equal?(type)}.compact
|
60
69
|
end
|
61
70
|
|
62
71
|
#
|
data/spec/cli_spec.rb
CHANGED
@@ -127,7 +127,7 @@ describe CLI do
|
|
127
127
|
context 'when executing shoot cli command' do
|
128
128
|
|
129
129
|
before(:each) do
|
130
|
-
allow(TestRail::Connection).to receive(:
|
130
|
+
allow(TestRail::Connection).to receive(:cases_ids_by_default).and_return(["11", "22", "33"])
|
131
131
|
allow(TestRail::Command).to receive(:execute_command).and_return("Ok")
|
132
132
|
end
|
133
133
|
|
@@ -142,7 +142,6 @@ describe CLI do
|
|
142
142
|
result = capture(:stdout) { @subject.shoot }
|
143
143
|
expect(result).to eq("You must set correct test run id through --test_run_id\n")
|
144
144
|
end
|
145
|
-
|
146
145
|
end
|
147
146
|
|
148
147
|
context 'and passing test_run_id param' do
|
@@ -155,6 +154,47 @@ describe CLI do
|
|
155
154
|
@subject.options.clear
|
156
155
|
end
|
157
156
|
|
157
|
+
context 'preparing type parameter' do
|
158
|
+
|
159
|
+
before(:each) do
|
160
|
+
@subject.options[:env] = 'staging'
|
161
|
+
@subject.options[:venture] = 'vn'
|
162
|
+
allow(TestRail::Connection).to receive(:cases_ids_by_default).and_call_original
|
163
|
+
allow(TestRail::Connection).to receive(:cases_by_default).and_return(
|
164
|
+
[{"case_id" => 1, "type_id" => 4}, {"case_id" => 2, "type_id" => 3}])
|
165
|
+
end
|
166
|
+
|
167
|
+
context 'and passing type parameter' do
|
168
|
+
|
169
|
+
before(:each) do
|
170
|
+
@subject.options[:type] = '3'
|
171
|
+
end
|
172
|
+
|
173
|
+
it 'should execute command' do
|
174
|
+
expect(TestRail::Command).to receive(:execute_command)
|
175
|
+
@subject.shoot
|
176
|
+
end
|
177
|
+
|
178
|
+
it 'should get tags with required type' do
|
179
|
+
result = capture(:stdout) { @subject.shoot }
|
180
|
+
expect(result).to eq("\"Gem will execute command: cucumber -p lazada.vn.staging TESTRAIL=1 --color -f json -o cucumber.json -t @C2\"\n")
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
context 'and not passing type parameter' do
|
185
|
+
|
186
|
+
it 'should execute command' do
|
187
|
+
expect(TestRail::Command).to receive(:execute_command)
|
188
|
+
@subject.shoot
|
189
|
+
end
|
190
|
+
|
191
|
+
it 'should get tags with default type' do
|
192
|
+
result = capture(:stdout) { @subject.shoot }
|
193
|
+
expect(result).to eq("\"Gem will execute command: cucumber -p lazada.vn.staging TESTRAIL=1 --color -f json -o cucumber.json -t @C1,@C2\"\n")
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
158
198
|
context 'and receiving simple param' do
|
159
199
|
|
160
200
|
before(:each) do
|
@@ -176,7 +216,6 @@ describe CLI do
|
|
176
216
|
result = capture(:stdout) { @subject.shoot }
|
177
217
|
expect(result).to eq("\"Gem will execute command: command @C11,@C22,@C33\"\n")
|
178
218
|
end
|
179
|
-
|
180
219
|
end
|
181
220
|
|
182
221
|
context 'and not passing required command param' do
|
@@ -190,9 +229,7 @@ describe CLI do
|
|
190
229
|
result = capture(:stdout) { @subject.shoot }
|
191
230
|
expect(result).to eq("You should add command param to execute simple execution\n")
|
192
231
|
end
|
193
|
-
|
194
232
|
end
|
195
|
-
|
196
233
|
end
|
197
234
|
|
198
235
|
context 'and receiving --auto param' do
|
@@ -219,7 +256,6 @@ describe CLI do
|
|
219
256
|
result = capture(:stdout) { @subject.shoot }
|
220
257
|
expect(result).to eq("Your test run name is not correct. It don't contain venture, env params. Please provide correct name for test run on test rail side.\n")
|
221
258
|
end
|
222
|
-
|
223
259
|
end
|
224
260
|
|
225
261
|
context 'and it dont have env inside' do
|
@@ -238,7 +274,6 @@ describe CLI do
|
|
238
274
|
result = capture(:stdout) { @subject.shoot }
|
239
275
|
expect(result).to eq("Your test run name is not correct. It don't contain env param. Please provide correct name for test run on test rail side.\n")
|
240
276
|
end
|
241
|
-
|
242
277
|
end
|
243
278
|
|
244
279
|
context 'and it dont have any params inside' do
|
@@ -257,9 +292,7 @@ describe CLI do
|
|
257
292
|
result = capture(:stdout) { @subject.shoot }
|
258
293
|
expect(result).to eq("Your test run name is not correct. It don't contain venture, env params. Please provide correct name for test run on test rail side.\n")
|
259
294
|
end
|
260
|
-
|
261
295
|
end
|
262
|
-
|
263
296
|
end
|
264
297
|
|
265
298
|
context 'and test run name is correct' do
|
@@ -298,7 +331,6 @@ describe CLI do
|
|
298
331
|
expect(TestRail::Command).to receive(:execute_command)
|
299
332
|
@subject.shoot
|
300
333
|
end
|
301
|
-
|
302
334
|
end
|
303
335
|
|
304
336
|
context 'and passing env param' do
|
@@ -320,7 +352,6 @@ describe CLI do
|
|
320
352
|
expect(TestRail::Command).to receive(:execute_command)
|
321
353
|
@subject.shoot
|
322
354
|
end
|
323
|
-
|
324
355
|
end
|
325
356
|
|
326
357
|
context 'and passing new command' do
|
@@ -367,7 +398,6 @@ describe CLI do
|
|
367
398
|
result = capture(:stdout) { @subject.shoot }
|
368
399
|
expect(result).to eq("You must set correct venture param through --venture in order to execute command\n")
|
369
400
|
end
|
370
|
-
|
371
401
|
end
|
372
402
|
|
373
403
|
context 'and not passing env param' do
|
@@ -389,7 +419,6 @@ describe CLI do
|
|
389
419
|
result = capture(:stdout) { @subject.shoot }
|
390
420
|
expect(result).to eq("You must set correct env param through --env in order to execute command\n")
|
391
421
|
end
|
392
|
-
|
393
422
|
end
|
394
423
|
|
395
424
|
context 'and not passing venture, env params' do
|
@@ -403,7 +432,6 @@ describe CLI do
|
|
403
432
|
result = capture(:stdout) { @subject.shoot }
|
404
433
|
expect(result).to eq("You must set correct env, venture params through --env, --venture in order to execute command\n")
|
405
434
|
end
|
406
|
-
|
407
435
|
end
|
408
436
|
|
409
437
|
context 'and passing all required params' do
|
@@ -453,7 +481,6 @@ describe CLI do
|
|
453
481
|
expect(TestRail::Command).to receive(:execute_command)
|
454
482
|
@subject.shoot
|
455
483
|
end
|
456
|
-
|
457
484
|
end
|
458
485
|
|
459
486
|
context 'and passing SR param' do
|
@@ -475,7 +502,6 @@ describe CLI do
|
|
475
502
|
result = capture(:stdout) { @subject.shoot }
|
476
503
|
expect(result).to eq("\"Gem will execute command: cucumber -p lazada.id.showroom SR='111' TESTRAIL=1 --color -f json -o cucumber.json -t @C11,@C22,@C33\"\n")
|
477
504
|
end
|
478
|
-
|
479
505
|
end
|
480
506
|
end
|
481
507
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test_rail_integration
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.9
|
4
|
+
version: 0.0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kirikami
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|