test_rail_integration 0.0.8.4 → 0.0.8.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0e772a2e9a834dcd76eeaa02f8e7708bb89b633b
4
- data.tar.gz: b681a5bd8585ba2efd51114592c9664ea514d4e3
3
+ metadata.gz: d09078ce8fa1cc3d90315396bec69525aa4fb50d
4
+ data.tar.gz: 4daa82c55557f06fa376040427ed7c83f8b8e2ba
5
5
  SHA512:
6
- metadata.gz: b6f0b14e636078ba0c215d44c14b11fc036906ddc767eb38d9db509d3351d930231b746d978f95f8b31f48b3a7a37684455eb7ac053b17c1a19616253effef8d
7
- data.tar.gz: 36ceea95180f0b21550064a024b7ecaf1d651a7e5551744d9a409581195d5a3b74ef194e85002642dda82872191961c7ae0704da4138365524723001f0de3ae2
6
+ metadata.gz: 7e283d2aa39b275e29dfc3cd08998aac7afa1d27d93ca60f476133dda42c2a3a28ebcb9da41780a538498da96d81ef1f36cdcafad9b898b4a986d2a8d507e972
7
+ data.tar.gz: 58fd2537b60f515992013d602e0246684aa396ce434422b339e75b3597190b8636f69229c3c293a71a935d57095d09fd4fcc893b3dae6759934b2b4494cb2401
data/.gitignore CHANGED
@@ -1 +1,2 @@
1
1
  .idea/*
2
+ Gemfile.lock
data/Gemfile CHANGED
@@ -4,4 +4,4 @@ gem 'thor'
4
4
  gem 'fileutils'
5
5
  gem 'rspec'
6
6
  gem 'simplecov-teamcity-summary'
7
- gem 'cucumber'
7
+ gem 'cucumber', '1.3.19'
@@ -1,11 +1,11 @@
1
1
  :connection_data:
2
- :url: https://mlp.testrail.com
3
- :username: Twilight
4
- :password: Sparkle
2
+ :url: #put here url of your TestRail server
3
+ :username: #TestRail username
4
+ :password: #Password for TestRail user
5
5
 
6
- :project: 2 # Test project id can be found in Test Rail
7
- :test_suite: 63 # Test suite id can be found in Test Rail
8
- :assigned_to: 27 # Id of person could be found in Test Rail
6
+ :project: # Test project id can be found in Test Rail
7
+ :test_suite: # Test suite id can be found in Test Rail
8
+ :assigned_to: # Id of person could be found in Test Rail
9
9
  :description_of_run: "Automatically generated report by auto tests."
10
10
 
11
11
  :status_comment: 0
@@ -22,9 +22,9 @@
22
22
 
23
23
  :in_progress: " (in progress)" #value for changing test run name for monitoring complete of test run
24
24
 
25
- :test_run_id: 513
25
+ :test_run_id: 777
26
26
 
27
- :exec_command: "cucumber -p lazada.#{parameters.venture}.#{parameters.environment} TESTRAIL=1 --format AllureCucumber::Formatter DRIVER=grid SELENIUM_GRID_SERVER_URL=http://192.168.100.1:4444/wd/hub -t "
27
+ :exec_command: "cucumber -p lazada.#{parameters.venture}.#{parameters.environment} TESTRAIL=1 --color -f json -o cucumber.json -t"
28
28
 
29
- :types: 4 #types for filtering from Test Rail
29
+ :types: #types for filtering from Test Rail
30
30
 
@@ -1,13 +1,13 @@
1
1
  require 'thor'
2
2
  require_relative 'generator/project'
3
3
  require_relative 'generator/project/check'
4
+ require_relative 'generator/test_run_creation'
4
5
 
5
6
  class CLI < Thor
6
7
  include TestRail
7
8
 
8
9
  desc "perform", "Creates project for interaction with TestRail"
9
10
  def perform
10
- TestRail::Generators::Project.copy_file('run_test_run.rb')
11
11
  TestRail::Generators::Project.copy_file("test_rail_data.yml", "config/data/")
12
12
  end
13
13
 
@@ -20,5 +20,45 @@ class CLI < Thor
20
20
  puts "You must set correct test run id through --test_run_id"
21
21
  end
22
22
  end
23
+
24
+ desc "shoot", "Run Test Rail integration with \n
25
+ --test_run_id for run id,
26
+ optional:
27
+ --venture for describing venture,
28
+ --env for describing environment for run,
29
+ --showroom with showroom name where start tests,
30
+ --command with new command
31
+ --auto for creating test run automatically and push all information inside"
32
+ option :test_run_id
33
+ option :venture
34
+ option :showroom
35
+ option :command
36
+ option :auto
37
+ def shoot
38
+ if options[:test_run_id]
39
+ run_id = options[:test_run_id]
40
+ name_of_environment = Connection.test_run_name(run_id).downcase.match(/(#{TestRunParameters::VENTURE_REGEX}) (#{TestRunParameters::ENVIRONMENT_REGEX})*/)
41
+ environment_for_run = name_of_environment[1], name_of_environment[2] if name_of_environment
42
+ environment_for_run[0] = options[:venture] if options[:venture]
43
+ environment_for_run[1] = options[:env] if options[:env]
44
+ if environment_for_run[1] == "showroom"
45
+ if options[:showroom]
46
+ environment_for_run[1] = environment_for_run[1] + " SR='#{options[:showroom]}'"
47
+ else
48
+ environment_for_run[1] = environment_for_run[1]
49
+ end
50
+ end
51
+ command = options[:command] if options[:command]
52
+ Connection.test_run_id = run_id
53
+ TestRailTools.write_test_run_id(run_id)
54
+ TestRailTools.execute_generated_command(run_id, environment_for_run, command)
55
+ elsif options[:auto]
56
+ run_id = TestRunCreation.initialize_test_run
57
+ environment_for_run = options[:venture], options[:env]
58
+ TestRailTools.execute_generated_command(run_id, environment_for_run)
59
+ else
60
+ puts "You must set correct test run id through --test_run_id"
61
+ end
62
+ end
23
63
  end
24
64
 
@@ -24,7 +24,7 @@
24
24
 
25
25
  :test_run_id: 0 #parametrized test run from "ruby run_test_run.rb <test run number>"
26
26
 
27
- :exec_command: "cucumber -p lazada.#{parameters.venture}.#{parameters.environment} TESTRAIL=1 --color -f json -o cucumber.json -t "
27
+ :exec_command: "cucumber -p lazada.#{parameters.venture}.#{parameters.environment} TESTRAIL=1 --color -f json -o cucumber.json -t"
28
28
 
29
29
  :types: #types for filtering from Test Rail
30
30
 
@@ -6,23 +6,23 @@ module TestRail
6
6
  class TestRailTools
7
7
 
8
8
  #
9
- # Method generates executable cucumber file
10
- #
11
- # generate_cucumber_execution_file(2)
9
+ # Method generates executable command
12
10
  #
13
11
  # cucumber -p profile.vn.live_test TESTRAIL=1 --color -f json -o cucumber.json -t @C666,@C777,@C555
14
12
  #
15
13
  # change this method for create your own cucumber executable
16
14
  #
17
- def self.generate_cucumber_execution_file(id_of_run, env = nil)
18
- parameters = TestRunParameters.new(env)
15
+ def self.generate_executable_command(id_of_run, env = nil, command = nil)
16
+ parameters = TestRunParameters.new(env, command)
19
17
  #TODO do smth with weird replacement
20
- 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(",")
21
- cucumber_file = File.new("cucumber_run.sh", "w")
22
- cucumber_file.chmod(0700)
23
- cucumber_file.write("#!/bin/sh\n")
24
- cucumber_file.write(command)
25
- cucumber_file.close
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
26
  end
27
27
 
28
28
  #
@@ -35,14 +35,6 @@ module TestRail
35
35
  config_file.close
36
36
  end
37
37
 
38
- #
39
- # Preparation for create right cucumber executable file
40
- #
41
- def self.prepare_config(run_id, env = nil)
42
- Connection.test_run_id = run_id
43
- write_test_run_id(run_id)
44
- generate_cucumber_execution_file(run_id, env)
45
- end
46
38
  end
47
39
  end
48
40
 
@@ -23,7 +23,6 @@ module TestRail
23
23
  created_test_run_id = test_runs.map { |test_run|
24
24
  test_run.fetch("id") if test_run.fetch("name").eql? Connection.generate_test_run_name
25
25
  }
26
- TestRailTools.write_test_run_id(created_test_run_id.first)
27
26
  created_test_run_id.first
28
27
  end
29
28
 
@@ -41,7 +40,8 @@ module TestRail
41
40
  unless TestRunCreation.check_presence_of_test_run
42
41
  Connection.create_new_test_run_with_name
43
42
  end
44
- TestRunCreation.get_created_test_run_id
43
+ created_test_run_id = TestRunCreation.get_created_test_run_id
44
+ TestRailTools.write_test_run_id(created_test_run_id)
45
45
  end
46
46
 
47
47
  end
@@ -12,7 +12,7 @@ module TestRail
12
12
  #
13
13
  # Checking of correct naming of created test run and return parameters for running test run
14
14
  #
15
- def initialize(env=nil)
15
+ def initialize(env = nil, command = nil)
16
16
  @venture = ""
17
17
  @environment = ""
18
18
  if env
@@ -24,6 +24,7 @@ module TestRail
24
24
  end
25
25
  end
26
26
  @command = EXEC_COMMAND
27
+ @command = command if command
27
28
  end
28
29
  end
29
30
  end
@@ -1,3 +1,3 @@
1
1
  module TestRailIntegration
2
- VERSION = "0.0.8.4"
2
+ VERSION = "0.0.8.5"
3
3
  end
@@ -39,7 +39,7 @@ describe 'Checking test run' do
39
39
 
40
40
  before(:each) do
41
41
  allow(TestRail::Connection).to receive(:cases_with_types).and_return([1011, 1213])
42
- allow(TestRail::Connection).to receive(:get_test_results).and_return([{"status_id" => 1, :comment => "FTW"}, {"status_id" => 5, :comment => "Burn heretics"}] )
42
+ allow(TestRail::Connection).to receive(:get_test_results).and_return([{"status_id" => 1, :comment => "FTW"}, {"status_id" => 5, :comment => "Burn heretics"}])
43
43
  allow(TestRail::Connection).to receive(:get_case_info).and_return({id: 1011, "title" => 'MLP'})
44
44
  allow(TestRail::Connection).to receive(:commit_test_result).and_return([])
45
45
  end
data/spec/cli_spec.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  require 'rspec'
2
2
  require_relative '../lib/test_rail_integration/cli'
3
+ require_relative '../lib/test_rail_integration/generator/connection'
4
+
3
5
 
4
6
  describe CLI do
5
7
 
@@ -13,21 +15,11 @@ describe CLI do
13
15
  @subject.perform
14
16
  end
15
17
 
16
- it 'run_test_run.rb should be copied' do
17
- expect(File.exist?('run_test_run.rb')).to eq(true)
18
- end
19
-
20
- it 'copied run_test_run.rb should be identical' do
21
- expect(File.read('run_test_run.rb')).to eq(File.read('lib/test_rail_integration/generator/project/run_test_run.rb'))
22
- end
23
-
24
18
  it 'test_rail_data.yml should be copied' do
25
19
  expect(File.exist?('config/data/test_rail_data.yml')).to eq(true)
26
20
  end
27
21
 
28
22
  it 'copied test_rail_data.yml should be identical' do
29
- expect(File.exist?('run_test_run.rb')).to eq(true)
30
- expect(File.read('run_test_run.rb')).to eq(File.read('lib/test_rail_integration/generator/project/run_test_run.rb'))
31
23
  expect(File.exist?('config/data/test_rail_data.yml')).to eq(true)
32
24
  expect(File.read('config/data/test_rail_data.yml')).to eq(File.read('lib/test_rail_integration/generator/project/test_rail_data.yml'))
33
25
  end
@@ -56,6 +48,10 @@ describe CLI do
56
48
  @subject.options = {:test_run_id => 12345}
57
49
  end
58
50
 
51
+ after(:all) do
52
+ @subject.options.clear
53
+ end
54
+
59
55
  it 'should execute command once' do
60
56
  expect(TestRail::Check).to receive(:check_test_run_statuses)
61
57
  @subject.check_test_run_and_update
@@ -71,4 +67,213 @@ describe CLI do
71
67
 
72
68
  end
73
69
 
74
- end
70
+ context 'when executing shoot cli command' do
71
+
72
+ before(:each) do
73
+ allow(TestRail::Connection).to receive(:test_run_name).and_return("AT id staging new")
74
+ allow(TestRail::Connection).to receive(:cases_id).and_return(["11", "22", "33"])
75
+ allow(TestRail::TestRailTools).to receive(:exec).and_return("Ok")
76
+ end
77
+
78
+ context 'and not passing test run id param' do
79
+
80
+ before(:each) do
81
+ allow(TestRail::Connection).to receive(:test_run_name).and_return("AT id staging new")
82
+ allow(TestRail::Connection).to receive(:cases_id).and_return(["11", "22", "33"])
83
+ end
84
+
85
+ it 'should not execute command once' do
86
+ expect(TestRail::TestRailTools).not_to receive(:exec)
87
+ @subject.shoot
88
+ end
89
+
90
+ it 'should see output ' do
91
+ result = capture(:stdout) { @subject.shoot }
92
+ expect(result).to eq("You must set correct test run id through --test_run_id\n")
93
+ end
94
+
95
+ end
96
+
97
+ context 'and not passing auto param' do
98
+
99
+ it 'should see output message' do
100
+ result = capture(:stdout) { @subject.shoot }
101
+ expect(result).to eq("You must set correct test run id through --test_run_id\n")
102
+ end
103
+
104
+ it 'should not execute command once' do
105
+ expect(TestRail::TestRailTools).not_to receive(:exec)
106
+ @subject.shoot
107
+ end
108
+
109
+ end
110
+
111
+ context 'and passing auto param flag' do
112
+
113
+ before(:each) do
114
+ @subject.options[:auto] = ''
115
+ @subject.options[:venture] = 'vn'
116
+ @subject.options[:env] = 'live_test'
117
+ allow(TestRail::TestRunCreation).to receive(:check_presence_of_test_run).and_return(true)
118
+ allow(TestRail::TestRunCreation).to receive(:get_created_test_run_id).and_return("12345")
119
+ end
120
+
121
+ after(:each) do
122
+ @subject.options.delete("auto")
123
+ @subject.options.delete("venture")
124
+ @subject.options.delete("env")
125
+ end
126
+
127
+ it 'should execute correct command' do
128
+ result = capture(:stdout) { @subject.shoot }
129
+ expect(result).to eq("\"Gem will execute command: cucumber -p lazada.vn.live_test TESTRAIL=1 --color -f json -o cucumber.json -t @C11,@C22,@C33\"\n")
130
+ end
131
+
132
+ it 'should write test run id in config file' do
133
+ @subject.shoot
134
+ expect(YAML.load(File.open(TestRail::TestRailDataLoad::TEST_RAIL_FILE_CONFIG_PATH))[:test_run_id]).to eq(12345)
135
+ end
136
+
137
+ it 'should call execution command' do
138
+ expect(TestRail::TestRailTools).to receive(:exec)
139
+ @subject.shoot
140
+ end
141
+
142
+ end
143
+
144
+ context 'and passing test_run_id param' do
145
+
146
+ before(:each) do
147
+ @subject.options = {:test_run_id => 777}
148
+ end
149
+
150
+ after(:all) do
151
+ @subject.options.clear
152
+ end
153
+
154
+ it 'should call execution command' do
155
+ expect(TestRail::TestRailTools).to receive(:exec)
156
+ @subject.shoot
157
+ end
158
+
159
+ it 'should execute correct command' do
160
+ result = capture(:stdout) { @subject.shoot }
161
+ 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")
162
+ end
163
+
164
+ context 'and passing venture param' do
165
+
166
+ before(:each) do
167
+ @subject.options[:venture] = 'vn'
168
+ end
169
+
170
+ after(:each) do
171
+ @subject.options.delete("venture")
172
+ end
173
+
174
+ it 'should execute correct command' do
175
+ result = capture(:stdout) { @subject.shoot }
176
+ 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")
177
+ end
178
+
179
+ it 'should call execution command' do
180
+ expect(TestRail::TestRailTools).to receive(:exec)
181
+ @subject.shoot
182
+ end
183
+
184
+
185
+ end
186
+
187
+ context 'and passing env param' do
188
+
189
+ before(:each) do
190
+ @subject.options[:env] = 'live_test'
191
+ end
192
+
193
+ after(:all) do
194
+ @subject.options.delete("env")
195
+ end
196
+
197
+ it 'should execute correct command' do
198
+ result = capture(:stdout) { @subject.shoot }
199
+ 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")
200
+ end
201
+
202
+ it 'should call execution command' do
203
+ expect(TestRail::TestRailTools).to receive(:exec)
204
+ @subject.shoot
205
+ end
206
+
207
+ end
208
+
209
+ context 'and passing showroom env param' do
210
+
211
+ before(:each) do
212
+ @subject.options[:env] = "showroom"
213
+ end
214
+
215
+ after(:all) do
216
+ @subject.options.delete("showroom")
217
+ end
218
+
219
+ context 'and not passing SR param' do
220
+
221
+ it 'should execute correct command' do
222
+ result = capture(:stdout) { @subject.shoot }
223
+ 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")
224
+ end
225
+
226
+ it 'should call execution command' do
227
+ expect(TestRail::TestRailTools).to receive(:exec)
228
+ @subject.shoot
229
+ end
230
+
231
+ end
232
+
233
+ context 'and passing SR param' do
234
+
235
+ before(:each) do
236
+ @subject.options[:showroom] = '111'
237
+ end
238
+
239
+ after(:each) do
240
+ @subject.options.delete("showroom")
241
+ end
242
+
243
+ it 'should call execution command' do
244
+ expect(TestRail::TestRailTools).to receive(:exec)
245
+ @subject.shoot
246
+ end
247
+
248
+ it 'should execute correct command' do
249
+ result = capture(:stdout) { @subject.shoot }
250
+ 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")
251
+ end
252
+
253
+ end
254
+ end
255
+
256
+ context 'and passing new command' do
257
+ before do
258
+ @subject.options[:command] = 'Command'
259
+ end
260
+
261
+ after do
262
+ @subject.options.delete("Command")
263
+ end
264
+
265
+ it 'should execute changed command' do
266
+ result = capture(:stdout) { @subject.shoot }
267
+ expect(result).to eq("\"Gem will execute command: Command @C11,@C22,@C33\"\n")
268
+ end
269
+ end
270
+ end
271
+ end
272
+ end
273
+
274
+
275
+
276
+
277
+
278
+
279
+
data/spec/hooks_spec.rb CHANGED
@@ -20,14 +20,14 @@ describe 'Update test results' do
20
20
  it 'current result should be passed' do
21
21
  test_result = TestRail::Hook.update_test_rail(passed_scenario)
22
22
  expect(test_result.test_case_id).to eq('4556')
23
- expect(test_result.comment).to eq({:status=>1, :comment => 'test **passed:**'})
23
+ expect(test_result.comment).to eq({:status => 1, :comment => 'test **passed:**'})
24
24
  expect(test_result.to_test_rail_api).to eq({:status_id => 1, :comment => "test **passed:** \"title\""})
25
25
  end
26
26
 
27
27
  it 'current result should be failed' do
28
28
  test_result = TestRail::Hook.update_test_rail(failed_scenario)
29
29
  expect(test_result.test_case_id).to eq('4556')
30
- expect(test_result.comment).to eq({:status=>5, :comment => 'test **failed:**'})
30
+ expect(test_result.comment).to eq({:status => 5, :comment => 'test **failed:**'})
31
31
  expect(test_result.to_test_rail_api).to eq({:status_id => 5, :comment => "test **failed:** \"title\"\n Exception : exception\n "})
32
32
  end
33
33
 
@@ -37,20 +37,20 @@ describe 'Update test results' do
37
37
 
38
38
  before(:each) do
39
39
  allow(TestRail::Connection).to receive(:get_test_results).and_return(
40
- [{"status_id" => 1, "comment" =>"test **passed:**"}])
40
+ [{"status_id" => 1, "comment" => "test **passed:**"}])
41
41
  end
42
42
 
43
43
  it 'current result should be passed' do
44
44
  test_result = TestRail::Hook.update_test_rail(passed_scenario)
45
45
  expect(test_result.test_case_id).to eq('4556')
46
- expect(test_result.comment).to eq({:status=>1, :comment => 'test **passed:**'})
46
+ expect(test_result.comment).to eq({:status => 1, :comment => 'test **passed:**'})
47
47
  expect(test_result.to_test_rail_api).to eq({:status_id => 1, :comment => "test **passed:** \"title\""})
48
48
  end
49
49
 
50
50
  it 'current result should be failed' do
51
51
  test_result = TestRail::Hook.update_test_rail(failed_scenario)
52
52
  expect(test_result.test_case_id).to eq('4556')
53
- expect(test_result.comment).to eq({:status=>5, :comment => 'test **failed:**'})
53
+ expect(test_result.comment).to eq({:status => 5, :comment => 'test **failed:**'})
54
54
  expect(test_result.to_test_rail_api).to eq({:status_id => 5, :comment => "test **failed:** \"title\"\n Exception : exception\n "})
55
55
  end
56
56
 
@@ -60,20 +60,20 @@ describe 'Update test results' do
60
60
 
61
61
  before(:each) do
62
62
  allow(TestRail::Connection).to receive(:get_test_results).and_return(
63
- [{"status_id" => 5, "comment" =>"test **failed:**"}])
63
+ [{"status_id" => 5, "comment" => "test **failed:**"}])
64
64
  end
65
65
 
66
66
  it 'current result should be failed' do
67
67
  test_result = TestRail::Hook.update_test_rail(failed_scenario)
68
68
  expect(test_result.test_case_id).to eq('4556')
69
- expect(test_result.comment).to eq({:status=>5, :comment => 'test **failed:**'})
69
+ expect(test_result.comment).to eq({:status => 5, :comment => 'test **failed:**'})
70
70
  expect(test_result.to_test_rail_api).to eq({:status_id => 5, :comment => "test **failed:** \"title\"\n Exception : exception\n test **failed:**"})
71
71
  end
72
72
 
73
73
  it 'current result should be comment' do
74
74
  test_result = TestRail::Hook.update_test_rail(passed_scenario)
75
75
  expect(test_result.test_case_id).to eq('4556')
76
- expect(test_result.comment).to eq({:status=>0, :comment => 'test **passed:**'})
76
+ expect(test_result.comment).to eq({:status => 0, :comment => 'test **passed:**'})
77
77
  expect(test_result.to_test_rail_api).to eq({:comment => "test **passed:** \"title\"\n test **failed:**"})
78
78
  end
79
79
 
@@ -83,21 +83,21 @@ describe 'Update test results' do
83
83
 
84
84
  before(:each) do
85
85
  allow(TestRail::Connection).to receive(:get_test_results).and_return(
86
- [{"status_id" => 5, "comment" =>"test **failed:**"}])
86
+ [{"status_id" => 5, "comment" => "test **failed:**"}])
87
87
  end
88
88
 
89
89
  it 'current result should be comment' do
90
90
  allow(@scenario).to receive(:passed?).and_return(true)
91
91
  test_result = TestRail::Hook.update_test_rail(passed_scenario)
92
92
  expect(test_result.test_case_id).to eq('4556')
93
- expect(test_result.comment).to eq({:status=>0, :comment => 'test **passed:**'})
93
+ expect(test_result.comment).to eq({:status => 0, :comment => 'test **passed:**'})
94
94
  expect(test_result.to_test_rail_api).to eq({:comment => "test **passed:** \"title\"\n test **failed:**"})
95
95
  end
96
96
 
97
97
  it 'current result should be failed' do
98
98
  test_result = TestRail::Hook.update_test_rail(failed_scenario)
99
99
  expect(test_result.test_case_id).to eq('4556')
100
- expect(test_result.comment).to eq({:status=>5, :comment => 'test **failed:**'})
100
+ expect(test_result.comment).to eq({:status => 5, :comment => 'test **failed:**'})
101
101
  expect(test_result.to_test_rail_api).to eq({:status_id => 5, :comment => "test **failed:** \"title\"\n Exception : exception\n test **failed:**"})
102
102
  end
103
103
 
data/spec/spec_helper.rb CHANGED
@@ -61,8 +61,8 @@ RSpec.configure do |config|
61
61
  mocks.verify_partial_doubles = true
62
62
  end
63
63
 
64
- # The settings below are suggested to provide a good initial experience
65
- # with RSpec, but feel free to customize to your heart's content.
64
+ # The settings below are suggested to provide a good initial experience
65
+ # with RSpec, but feel free to customize to your heart's content.
66
66
  =begin
67
67
  # These two settings work together to allow you to limit a spec run
68
68
  # to individual examples or groups you care about by tagging them with
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.8.4
4
+ version: 0.0.8.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kirikami
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-27 00:00:00.000000000 Z
11
+ date: 2015-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -77,7 +77,6 @@ files:
77
77
  - ".gitignore"
78
78
  - ".rspec"
79
79
  - Gemfile
80
- - Gemfile.lock
81
80
  - LICENSE.txt
82
81
  - README.md
83
82
  - Rakefile
@@ -170,7 +169,6 @@ files:
170
169
  - lib/test_rail_integration/generator/connection.rb
171
170
  - lib/test_rail_integration/generator/project.rb
172
171
  - lib/test_rail_integration/generator/project/check.rb
173
- - lib/test_rail_integration/generator/project/run_test_run.rb
174
172
  - lib/test_rail_integration/generator/project/test_rail_data.yml
175
173
  - lib/test_rail_integration/generator/test_case_result.rb
176
174
  - lib/test_rail_integration/generator/test_rail_data_load.rb
data/Gemfile.lock DELETED
@@ -1,29 +0,0 @@
1
- GEM
2
- remote: https://rubygems.org/
3
- specs:
4
- diff-lcs (1.2.5)
5
- fileutils (0.7)
6
- rmagick (>= 2.13.1)
7
- rmagick (2.13.4)
8
- rspec (3.2.0)
9
- rspec-core (~> 3.2.0)
10
- rspec-expectations (~> 3.2.0)
11
- rspec-mocks (~> 3.2.0)
12
- rspec-core (3.2.1)
13
- rspec-support (~> 3.2.0)
14
- rspec-expectations (3.2.0)
15
- diff-lcs (>= 1.2.0, < 2.0)
16
- rspec-support (~> 3.2.0)
17
- rspec-mocks (3.2.1)
18
- diff-lcs (>= 1.2.0, < 2.0)
19
- rspec-support (~> 3.2.0)
20
- rspec-support (3.2.2)
21
- thor (0.19.1)
22
-
23
- PLATFORMS
24
- ruby
25
-
26
- DEPENDENCIES
27
- fileutils
28
- rspec
29
- thor
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'test_rail_integration/generator/test_rail_data_load'
3
- require 'test_rail_integration'
4
- require 'thor'
5
- require 'test_rail_integration/generator/API_client'
6
- require 'test_rail_integration/generator/connection'
7
- require 'test_rail_integration/generator/test_run_creation'
8
- require 'test_rail_integration/generator/test_rail_tools'
9
-
10
- module TestRail
11
- unless Generators::Project.test_rail_data_file_exist?
12
- Generators::Project.copy_file("test_rail_data.yml")
13
- raise "Please fill all required data in test rail data yml file"
14
- end
15
-
16
- parameters = ARGV
17
- #TODO Make Hash instead of array for parameters
18
- if parameters[0] == 'auto'
19
- environment_for_run = parameters[1], parameters[2]
20
- id_of_run = TestRunCreation.initialize_test_run
21
- else
22
- id_of_run = parameters[0].to_i
23
- name_of_environment = Connection.test_run_name(id_of_run).downcase.match(/(#{TestRunParameters::VENTURE_REGEX}) (#{TestRunParameters::ENVIRONMENT_REGEX})*/)
24
- environment_for_run = name_of_environment[1], name_of_environment[2] if name_of_environment
25
- environment_for_run[0] = parameters[1] if parameters.size > 1
26
- end
27
- TestRailTools.prepare_config(id_of_run, environment_for_run)
28
- end
29
-