test_rail_integration 0.0.8.9 → 0.0.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/test_rail_integration/cli.rb +60 -15
- data/lib/test_rail_integration/generator/command.rb +36 -0
- data/lib/test_rail_integration/generator/test_rail_tools.rb +0 -21
- data/lib/test_rail_integration/generator/test_run.rb +7 -1
- data/lib/test_rail_integration/generator/test_run_parameters.rb +0 -20
- data/lib/test_rail_integration/version.rb +1 -1
- data/spec/cli_spec.rb +260 -60
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7c37b512c02fe5a2b92d5e28c38d7c010f6f1c2
|
4
|
+
data.tar.gz: 3b0c49e57e8afb605ada67a2e146dfa9ab9a1dc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fd5ef3b558c16caed8781cae8848c7bacd26fe486dc29f1f3f90b52dd5c497ea14362bfe6029a846b95fcb21f820e24d11709b8d33ff6cc026eed21d3059ae0
|
7
|
+
data.tar.gz: bfbe8e4a8783f1a894d63ae1449258345803bf342cdf1b9979e13e56f895ff80332f08d042fda90b59a034635ace21cc00571369b1685c12caa5dddcb19ca1ab
|
@@ -2,6 +2,7 @@ require 'thor'
|
|
2
2
|
require_relative 'generator/project'
|
3
3
|
require_relative 'generator/project/check'
|
4
4
|
require_relative 'generator/test_run'
|
5
|
+
require_relative 'generator/command'
|
5
6
|
|
6
7
|
class CLI < Thor
|
7
8
|
include TestRail
|
@@ -43,30 +44,74 @@ class CLI < Thor
|
|
43
44
|
--venture for describing venture,
|
44
45
|
--env for describing environment for run,
|
45
46
|
--showroom with showroom name where start tests,
|
46
|
-
--command with new command
|
47
|
+
--command with new command,
|
48
|
+
--auto for getting env, venture params from test run name,
|
49
|
+
--simple for run without venture and env params."
|
47
50
|
option :test_run_id
|
48
51
|
option :venture
|
49
52
|
option :showroom
|
50
53
|
option :command
|
51
54
|
option :env
|
55
|
+
option :auto
|
56
|
+
option :simple
|
52
57
|
def shoot
|
53
58
|
if options[:test_run_id]
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
if
|
61
|
-
|
62
|
-
|
63
|
-
environment_for_run[1] = environment_for_run[1]
|
59
|
+
test_run_id = options[:test_run_id]
|
60
|
+
Connection.test_run_id = test_run_id
|
61
|
+
TestRailTools.write_test_run_id(test_run_id)
|
62
|
+
command = TestRail::Command.new(test_run_id)
|
63
|
+
if options[:auto]
|
64
|
+
parameters = TestRail::TestRun.get_by_id(test_run_id).name.downcase.match(/(#{TestRunParameters::VENTURE_REGEX}) (#{TestRunParameters::ENVIRONMENT_REGEX})*/)
|
65
|
+
if parameters.nil?
|
66
|
+
puts "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."
|
67
|
+
return
|
64
68
|
end
|
69
|
+
if parameters[1].nil?
|
70
|
+
puts "Your test run name is not correct. It don't contain venture param. Please provide correct name for test run on test rail side."
|
71
|
+
return
|
72
|
+
end
|
73
|
+
if parameters[2].nil?
|
74
|
+
puts "Your test run name is not correct. It don't contain env param. Please provide correct name for test run on test rail side."
|
75
|
+
return
|
76
|
+
end
|
77
|
+
if parameters
|
78
|
+
# TODO venture can be everything
|
79
|
+
if options[:venture]
|
80
|
+
command.venture = options[:venture]
|
81
|
+
else
|
82
|
+
command.venture = parameters[1]
|
83
|
+
end
|
84
|
+
command.env = parameters[2]
|
85
|
+
end
|
86
|
+
elsif options[:simple] && !options[:command]
|
87
|
+
puts "You should add command param to execute simple execution"
|
88
|
+
return
|
89
|
+
elsif !options[:simple] && !options[:command]
|
90
|
+
if options[:venture].nil? && options[:env].nil?
|
91
|
+
puts "You must set correct env, venture params through --env, --venture in order to execute command"
|
92
|
+
return
|
93
|
+
end
|
94
|
+
if options[:venture].nil?
|
95
|
+
puts "You must set correct venture param through --venture in order to execute command"
|
96
|
+
return
|
97
|
+
end
|
98
|
+
if options[:env].nil?
|
99
|
+
puts "You must set correct env param through --env in order to execute command"
|
100
|
+
return
|
101
|
+
end
|
102
|
+
command.venture = options[:venture]
|
103
|
+
command.env = options[:env]
|
104
|
+
end
|
105
|
+
if options[:env] == "showroom" && options[:showroom]
|
106
|
+
command.env = command.env + " SR='#{options[:showroom]}'"
|
107
|
+
end
|
108
|
+
if options[:command]
|
109
|
+
command.command = options[:command]
|
110
|
+
else
|
111
|
+
command.command = TestRunParameters::EXEC_COMMAND
|
65
112
|
end
|
66
|
-
command
|
67
|
-
|
68
|
-
TestRailTools.write_test_run_id(run_id)
|
69
|
-
TestRailTools.execute_generated_command(run_id, environment_for_run, command)
|
113
|
+
command.generate
|
114
|
+
command.execute
|
70
115
|
else
|
71
116
|
puts "You must set correct test run id through --test_run_id"
|
72
117
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module TestRail
|
2
|
+
|
3
|
+
class Command
|
4
|
+
|
5
|
+
attr_accessor :command,
|
6
|
+
:tags,
|
7
|
+
:venture,
|
8
|
+
:env
|
9
|
+
|
10
|
+
def initialize(id_of_run)
|
11
|
+
self.tags = get_tags(id_of_run)
|
12
|
+
end
|
13
|
+
|
14
|
+
def execute
|
15
|
+
p "Gem will execute command: #{self.command}"
|
16
|
+
TestRail::Command.execute_command("#{self.command}")
|
17
|
+
end
|
18
|
+
|
19
|
+
def generate
|
20
|
+
#TODO do smth with weird replacement
|
21
|
+
if venture.nil? || env.nil?
|
22
|
+
self.command = self.command + " " + self.tags
|
23
|
+
else
|
24
|
+
self.command = self.command.gsub("\#{parameters.venture}", self.venture).gsub("\#{parameters.environment}", self.env) + " " + self.tags
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def get_tags(id_of_run)
|
29
|
+
Connection.cases_id(id_of_run).map { |id| "@C"+id.to_s }.join(",")
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.execute_command(command)
|
33
|
+
exec("#{command}")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -5,26 +5,6 @@ require_relative 'test_run_parameters'
|
|
5
5
|
module TestRail
|
6
6
|
class TestRailTools
|
7
7
|
|
8
|
-
#
|
9
|
-
# Method generates executable command
|
10
|
-
#
|
11
|
-
# cucumber -p profile.vn.live_test TESTRAIL=1 --color -f json -o cucumber.json -t @C666,@C777,@C555
|
12
|
-
#
|
13
|
-
# change this method for create your own cucumber executable
|
14
|
-
#
|
15
|
-
def self.generate_executable_command(id_of_run, env = nil, command = nil)
|
16
|
-
parameters = TestRunParameters.new(env, command)
|
17
|
-
#TODO do smth with weird replacement
|
18
|
-
command = parameters.command.gsub("\#{parameters.venture}", parameters.venture).gsub("\#{parameters.environment}", parameters.environment) + " " + Connection.cases_id(id_of_run).map { |id| "@C"+id.to_s }.join(",")
|
19
|
-
command
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.execute_generated_command(id_of_run, env = nil, command = nil)
|
23
|
-
exec_command = generate_executable_command(id_of_run, env, command)
|
24
|
-
p "Gem will execute command: #{exec_command}"
|
25
|
-
exec("#{exec_command}")
|
26
|
-
end
|
27
|
-
|
28
8
|
#
|
29
9
|
# Writing test run ID into test rail data file
|
30
10
|
#
|
@@ -35,7 +15,6 @@ module TestRail
|
|
35
15
|
config_file.close
|
36
16
|
test_run_id
|
37
17
|
end
|
38
|
-
|
39
18
|
end
|
40
19
|
end
|
41
20
|
|
@@ -2,16 +2,22 @@ module TestRail
|
|
2
2
|
|
3
3
|
class TestRun
|
4
4
|
|
5
|
-
attr_accessor :id
|
5
|
+
attr_accessor :id, :name
|
6
6
|
|
7
7
|
private
|
8
8
|
def initialize(result)
|
9
9
|
self.id = result["id"]
|
10
|
+
self.name = result["name"]
|
10
11
|
end
|
11
12
|
|
12
13
|
def self.create(test_run_name)
|
13
14
|
command_result = TestRail::Connection.create_test_run_with_name(test_run_name)
|
14
15
|
TestRun.new(command_result)
|
15
16
|
end
|
17
|
+
|
18
|
+
def self.get_by_id(test_run_id)
|
19
|
+
command_result = Connection.test_run_data(test_run_id)
|
20
|
+
TestRun.new(command_result)
|
21
|
+
end
|
16
22
|
end
|
17
23
|
end
|
@@ -6,25 +6,5 @@ module TestRail
|
|
6
6
|
ENVIRONMENT_REGEX ||= TestRail::TestRailDataLoad.test_rail_data[:environments]
|
7
7
|
CHECK_TEST_RUN_NAME ||= TestRail::TestRailDataLoad.test_rail_data[:check_test_run_name]
|
8
8
|
EXEC_COMMAND ||= TestRail::TestRailDataLoad.test_rail_data[:exec_command]
|
9
|
-
|
10
|
-
attr_accessor :environment, :venture, :command
|
11
|
-
|
12
|
-
#
|
13
|
-
# Checking of correct naming of created test run and return parameters for running test run
|
14
|
-
#
|
15
|
-
def initialize(env = nil, command = nil)
|
16
|
-
@venture = ""
|
17
|
-
@environment = ""
|
18
|
-
if env
|
19
|
-
if env[0]
|
20
|
-
@venture = env[0] if env[0].match(/(#{VENTURE_REGEX})/)
|
21
|
-
end
|
22
|
-
if env[1]
|
23
|
-
@environment = env[1] if env[1].match(/(#{ENVIRONMENT_REGEX})/)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
@command = EXEC_COMMAND
|
27
|
-
@command = command if command
|
28
|
-
end
|
29
9
|
end
|
30
10
|
end
|
data/spec/cli_spec.rb
CHANGED
@@ -2,7 +2,6 @@ require 'rspec'
|
|
2
2
|
require_relative '../lib/test_rail_integration/cli'
|
3
3
|
require_relative '../lib/test_rail_integration/generator/connection'
|
4
4
|
|
5
|
-
|
6
5
|
describe CLI do
|
7
6
|
|
8
7
|
before(:all) do
|
@@ -128,20 +127,14 @@ describe CLI do
|
|
128
127
|
context 'when executing shoot cli command' do
|
129
128
|
|
130
129
|
before(:each) do
|
131
|
-
allow(TestRail::Connection).to receive(:test_run_name).and_return("AT id staging new")
|
132
130
|
allow(TestRail::Connection).to receive(:cases_id).and_return(["11", "22", "33"])
|
133
|
-
allow(TestRail::
|
131
|
+
allow(TestRail::Command).to receive(:execute_command).and_return("Ok")
|
134
132
|
end
|
135
133
|
|
136
134
|
context 'and not passing test run id param' do
|
137
135
|
|
138
|
-
before(:each) do
|
139
|
-
allow(TestRail::Connection).to receive(:test_run_name).and_return("AT id staging new")
|
140
|
-
allow(TestRail::Connection).to receive(:cases_id).and_return(["11", "22", "33"])
|
141
|
-
end
|
142
|
-
|
143
136
|
it 'should not execute command once' do
|
144
|
-
expect(TestRail::
|
137
|
+
expect(TestRail::Command).not_to receive(:execute_command)
|
145
138
|
@subject.shoot
|
146
139
|
end
|
147
140
|
|
@@ -158,124 +151,331 @@ describe CLI do
|
|
158
151
|
@subject.options = {:test_run_id => 777}
|
159
152
|
end
|
160
153
|
|
161
|
-
after(:
|
154
|
+
after(:each) do
|
162
155
|
@subject.options.clear
|
163
156
|
end
|
164
157
|
|
165
|
-
|
166
|
-
expect(TestRail::TestRailTools).to receive(:exec)
|
167
|
-
@subject.shoot
|
168
|
-
end
|
158
|
+
context 'and receiving simple param' do
|
169
159
|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
end
|
160
|
+
before(:each) do
|
161
|
+
@subject.options[:simple] = ''
|
162
|
+
end
|
174
163
|
|
175
|
-
context 'and passing
|
164
|
+
context 'and passing required command param' do
|
176
165
|
|
177
166
|
before(:each) do
|
178
|
-
@subject.options[:
|
167
|
+
@subject.options[:command] = 'command'
|
179
168
|
end
|
180
169
|
|
181
|
-
|
182
|
-
|
170
|
+
it 'should call execution command' do
|
171
|
+
expect(TestRail::Command).to receive(:execute_command)
|
172
|
+
@subject.shoot
|
183
173
|
end
|
184
174
|
|
185
|
-
it 'should
|
175
|
+
it 'should have output' do
|
186
176
|
result = capture(:stdout) { @subject.shoot }
|
187
|
-
expect(result).to eq("\"Gem will execute command:
|
177
|
+
expect(result).to eq("\"Gem will execute command: command @C11,@C22,@C33\"\n")
|
188
178
|
end
|
189
179
|
|
190
|
-
|
191
|
-
|
180
|
+
end
|
181
|
+
|
182
|
+
context 'and not passing required command param' do
|
183
|
+
|
184
|
+
it 'should not call execution command' do
|
185
|
+
expect(TestRail::Command).not_to receive(:execute_command)
|
192
186
|
@subject.shoot
|
193
187
|
end
|
194
188
|
|
189
|
+
it 'should have output' do
|
190
|
+
result = capture(:stdout) { @subject.shoot }
|
191
|
+
expect(result).to eq("You should add command param to execute simple execution\n")
|
192
|
+
end
|
195
193
|
|
196
194
|
end
|
197
195
|
|
198
|
-
|
196
|
+
end
|
199
197
|
|
200
|
-
|
201
|
-
|
202
|
-
|
198
|
+
context 'and receiving --auto param' do
|
199
|
+
|
200
|
+
before(:each) do
|
201
|
+
@subject.options[:auto] = ''
|
202
|
+
end
|
203
|
+
|
204
|
+
context 'and test run name is incorrect' do
|
205
|
+
|
206
|
+
context 'and it dont have venture inside' do
|
207
|
+
|
208
|
+
before(:each) do
|
209
|
+
allow(TestRail::Connection).to receive(:test_run_data).and_return(
|
210
|
+
{"name" => "AT hh staging"})
|
211
|
+
end
|
212
|
+
|
213
|
+
it 'should not call execution command' do
|
214
|
+
expect(TestRail::Command).not_to receive(:execute_command)
|
215
|
+
@subject.shoot
|
216
|
+
end
|
217
|
+
|
218
|
+
it 'should have output' do
|
219
|
+
result = capture(:stdout) { @subject.shoot }
|
220
|
+
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
|
+
end
|
203
222
|
|
204
|
-
after(:all) do
|
205
|
-
@subject.options.delete("env")
|
206
223
|
end
|
207
224
|
|
208
|
-
|
209
|
-
|
210
|
-
|
225
|
+
context 'and it dont have env inside' do
|
226
|
+
|
227
|
+
before(:each) do
|
228
|
+
allow(TestRail::Connection).to receive(:test_run_data).and_return(
|
229
|
+
{"name" => "AT id error"})
|
230
|
+
end
|
231
|
+
|
232
|
+
it 'should not call execution command' do
|
233
|
+
expect(TestRail::Command).not_to receive(:execute_command)
|
234
|
+
@subject.shoot
|
235
|
+
end
|
236
|
+
|
237
|
+
it 'should have output' do
|
238
|
+
result = capture(:stdout) { @subject.shoot }
|
239
|
+
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
|
+
end
|
241
|
+
|
211
242
|
end
|
212
243
|
|
213
|
-
|
214
|
-
|
215
|
-
|
244
|
+
context 'and it dont have any params inside' do
|
245
|
+
|
246
|
+
before(:each) do
|
247
|
+
allow(TestRail::Connection).to receive(:test_run_data).and_return(
|
248
|
+
{"name" => "Simple test run name"})
|
249
|
+
end
|
250
|
+
|
251
|
+
it 'should not call execution command' do
|
252
|
+
expect(TestRail::Command).not_to receive(:execute_command)
|
253
|
+
@subject.shoot
|
254
|
+
end
|
255
|
+
|
256
|
+
it 'should have output' do
|
257
|
+
result = capture(:stdout) { @subject.shoot }
|
258
|
+
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
|
+
end
|
260
|
+
|
216
261
|
end
|
217
262
|
|
218
263
|
end
|
219
264
|
|
220
|
-
context 'and
|
265
|
+
context 'and test run name is correct' do
|
221
266
|
|
222
267
|
before(:each) do
|
223
|
-
|
268
|
+
allow(TestRail::Connection).to receive(:test_run_data).and_return(
|
269
|
+
{"name" => "AT id staging new"})
|
224
270
|
end
|
225
271
|
|
226
|
-
|
227
|
-
|
272
|
+
it 'should call execution command' do
|
273
|
+
expect(TestRail::Command).to receive(:execute_command)
|
274
|
+
@subject.shoot
|
275
|
+
end
|
276
|
+
|
277
|
+
it 'should execute correct command' do
|
278
|
+
result = capture(:stdout) { @subject.shoot }
|
279
|
+
expect(result).to eq("\"Gem will execute command: cucumber -p lazada.id.staging TESTRAIL=1 --color -f json -o cucumber.json -t @C11,@C22,@C33\"\n")
|
228
280
|
end
|
229
281
|
|
230
|
-
context 'and
|
282
|
+
context 'and passing venture param' do
|
283
|
+
|
284
|
+
before(:each) do
|
285
|
+
@subject.options[:venture] = 'vn'
|
286
|
+
end
|
287
|
+
|
288
|
+
after(:each) do
|
289
|
+
@subject.options.delete("venture")
|
290
|
+
end
|
231
291
|
|
232
292
|
it 'should execute correct command' do
|
233
293
|
result = capture(:stdout) { @subject.shoot }
|
234
|
-
expect(result).to eq("\"Gem will execute command: cucumber -p lazada.
|
294
|
+
expect(result).to eq("\"Gem will execute command: cucumber -p lazada.vn.staging TESTRAIL=1 --color -f json -o cucumber.json -t @C11,@C22,@C33\"\n")
|
235
295
|
end
|
236
296
|
|
237
297
|
it 'should call execution command' do
|
238
|
-
expect(TestRail::
|
298
|
+
expect(TestRail::Command).to receive(:execute_command)
|
239
299
|
@subject.shoot
|
240
300
|
end
|
241
301
|
|
242
302
|
end
|
243
303
|
|
244
|
-
context 'and passing
|
304
|
+
context 'and passing env param' do
|
245
305
|
|
246
306
|
before(:each) do
|
247
|
-
@subject.options[:
|
307
|
+
@subject.options[:env] = 'live_test'
|
248
308
|
end
|
249
309
|
|
250
|
-
after(:
|
251
|
-
@subject.options.delete("
|
310
|
+
after(:all) do
|
311
|
+
@subject.options.delete("env")
|
312
|
+
end
|
313
|
+
|
314
|
+
it 'should execute correct command' do
|
315
|
+
result = capture(:stdout) { @subject.shoot }
|
316
|
+
expect(result).to eq("\"Gem will execute command: cucumber -p lazada.id.staging TESTRAIL=1 --color -f json -o cucumber.json -t @C11,@C22,@C33\"\n")
|
252
317
|
end
|
253
318
|
|
254
319
|
it 'should call execution command' do
|
255
|
-
expect(TestRail::
|
320
|
+
expect(TestRail::Command).to receive(:execute_command)
|
256
321
|
@subject.shoot
|
257
322
|
end
|
258
323
|
|
259
|
-
|
324
|
+
end
|
325
|
+
|
326
|
+
context 'and passing new command' do
|
327
|
+
|
328
|
+
before do
|
329
|
+
@subject.options[:command] = 'Command'
|
330
|
+
end
|
331
|
+
|
332
|
+
after do
|
333
|
+
@subject.options.delete("Command")
|
334
|
+
end
|
335
|
+
|
336
|
+
it 'should execute changed command' do
|
260
337
|
result = capture(:stdout) { @subject.shoot }
|
261
|
-
expect(result).to eq("\"Gem will execute command:
|
338
|
+
expect(result).to eq("\"Gem will execute command: Command @C11,@C22,@C33\"\n")
|
262
339
|
end
|
340
|
+
end
|
341
|
+
end
|
342
|
+
end
|
343
|
+
|
344
|
+
context 'and not receiving --auto param' do
|
345
|
+
|
346
|
+
before(:each) do
|
347
|
+
allow(TestRail::Connection).to receive(:test_run_data).and_return(
|
348
|
+
{"name" => "Simple test run name"})
|
349
|
+
end
|
350
|
+
|
351
|
+
context 'and not passing venture param' do
|
352
|
+
|
353
|
+
before(:each) do
|
354
|
+
@subject.options[:env] = 'live_test'
|
355
|
+
end
|
356
|
+
|
357
|
+
after(:each) do
|
358
|
+
@subject.options.delete("env")
|
359
|
+
end
|
360
|
+
|
361
|
+
it 'should not call execution command' do
|
362
|
+
expect(TestRail::Command).not_to receive(:execute_command)
|
363
|
+
@subject.shoot
|
364
|
+
end
|
365
|
+
|
366
|
+
it 'should see output ' do
|
367
|
+
result = capture(:stdout) { @subject.shoot }
|
368
|
+
expect(result).to eq("You must set correct venture param through --venture in order to execute command\n")
|
369
|
+
end
|
370
|
+
|
371
|
+
end
|
372
|
+
|
373
|
+
context 'and not passing env param' do
|
374
|
+
|
375
|
+
before(:each) do
|
376
|
+
@subject.options[:venture] = 'id'
|
377
|
+
end
|
378
|
+
|
379
|
+
after(:each) do
|
380
|
+
@subject.options.delete("venture")
|
381
|
+
end
|
382
|
+
|
383
|
+
it 'should not call execution command' do
|
384
|
+
expect(TestRail::Command).not_to receive(:execute_command)
|
385
|
+
@subject.shoot
|
386
|
+
end
|
387
|
+
|
388
|
+
it 'should see output ' do
|
389
|
+
result = capture(:stdout) { @subject.shoot }
|
390
|
+
expect(result).to eq("You must set correct env param through --env in order to execute command\n")
|
391
|
+
end
|
392
|
+
|
393
|
+
end
|
394
|
+
|
395
|
+
context 'and not passing venture, env params' do
|
396
|
+
|
397
|
+
it 'should not call execution command' do
|
398
|
+
expect(TestRail::Command).not_to receive(:execute_command)
|
399
|
+
@subject.shoot
|
400
|
+
end
|
401
|
+
|
402
|
+
it 'should see output ' do
|
403
|
+
result = capture(:stdout) { @subject.shoot }
|
404
|
+
expect(result).to eq("You must set correct env, venture params through --env, --venture in order to execute command\n")
|
405
|
+
end
|
406
|
+
|
407
|
+
end
|
263
408
|
|
409
|
+
context 'and passing all required params' do
|
410
|
+
|
411
|
+
before(:each) do
|
412
|
+
@subject.options[:venture] = 'id'
|
413
|
+
@subject.options[:env] = 'live_test'
|
414
|
+
end
|
415
|
+
|
416
|
+
after(:each) do
|
417
|
+
@subject.options.delete("venture")
|
418
|
+
@subject.options.delete("env")
|
419
|
+
end
|
420
|
+
|
421
|
+
it 'should call execution command' do
|
422
|
+
expect(TestRail::Command).to receive(:execute_command)
|
423
|
+
@subject.shoot
|
424
|
+
end
|
425
|
+
|
426
|
+
it 'should execute correct command' do
|
427
|
+
result = capture(:stdout) { @subject.shoot }
|
428
|
+
expect(result).to eq("\"Gem will execute command: cucumber -p lazada.id.live_test TESTRAIL=1 --color -f json -o cucumber.json -t @C11,@C22,@C33\"\n")
|
264
429
|
end
|
265
430
|
end
|
431
|
+
end
|
266
432
|
|
267
|
-
context 'and passing
|
268
|
-
|
269
|
-
|
433
|
+
context 'and passing showroom env param' do
|
434
|
+
|
435
|
+
before(:each) do
|
436
|
+
@subject.options[:env] = "showroom"
|
437
|
+
@subject.options[:venture] = "id"
|
438
|
+
end
|
439
|
+
|
440
|
+
after(:each) do
|
441
|
+
@subject.options.delete("showroom")
|
442
|
+
@subject.options.delete("venture")
|
270
443
|
end
|
271
444
|
|
272
|
-
|
273
|
-
|
445
|
+
context 'and not passing SR param' do
|
446
|
+
|
447
|
+
it 'should execute correct command' do
|
448
|
+
result = capture(:stdout) { @subject.shoot }
|
449
|
+
expect(result).to eq("\"Gem will execute command: cucumber -p lazada.id.showroom TESTRAIL=1 --color -f json -o cucumber.json -t @C11,@C22,@C33\"\n")
|
450
|
+
end
|
451
|
+
|
452
|
+
it 'should call execution command' do
|
453
|
+
expect(TestRail::Command).to receive(:execute_command)
|
454
|
+
@subject.shoot
|
455
|
+
end
|
456
|
+
|
274
457
|
end
|
275
458
|
|
276
|
-
|
277
|
-
|
278
|
-
|
459
|
+
context 'and passing SR param' do
|
460
|
+
|
461
|
+
before(:each) do
|
462
|
+
@subject.options[:showroom] = '111'
|
463
|
+
end
|
464
|
+
|
465
|
+
after(:each) do
|
466
|
+
@subject.options.delete("showroom")
|
467
|
+
end
|
468
|
+
|
469
|
+
it 'should call execution command' do
|
470
|
+
expect(TestRail::Command).to receive(:execute_command)
|
471
|
+
@subject.shoot
|
472
|
+
end
|
473
|
+
|
474
|
+
it 'should execute correct command' do
|
475
|
+
result = capture(:stdout) { @subject.shoot }
|
476
|
+
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
|
+
end
|
478
|
+
|
279
479
|
end
|
280
480
|
end
|
281
481
|
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.
|
4
|
+
version: 0.0.9
|
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-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -166,6 +166,7 @@ files:
|
|
166
166
|
- lib/test_rail_integration.rb
|
167
167
|
- lib/test_rail_integration/cli.rb
|
168
168
|
- lib/test_rail_integration/generator/API_client.rb
|
169
|
+
- lib/test_rail_integration/generator/command.rb
|
169
170
|
- lib/test_rail_integration/generator/connection.rb
|
170
171
|
- lib/test_rail_integration/generator/project.rb
|
171
172
|
- lib/test_rail_integration/generator/project/check.rb
|