test_rail_integration 0.0.9.1 → 0.0.9.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6be0e981007474d44975ad766ef17025330fe2e
|
4
|
+
data.tar.gz: fbb645c2798102f90b0ac8c83e57e6b899d62ec0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8af6f8a8e1ec04bd87b420749b36db0460fc09415cb74b7654ba5e9043dee68ea4b2e9c1a625c3afefeef3327085773cfb6b3a8b57648d3440f93ae4334831b9
|
7
|
+
data.tar.gz: fbe01707a5abd6aacee25c06f6ab6d62bc7cc9e6d78edcf8bc4476c15091680b2c6e7aa3e65d5266a84460360cf8f43c2d935fb134d4bd4f11bccec421468c18
|
@@ -8,37 +8,43 @@ class CLI < Thor
|
|
8
8
|
include TestRail
|
9
9
|
|
10
10
|
desc "perform", "Creates project for interaction with TestRail"
|
11
|
+
|
11
12
|
def perform
|
12
13
|
TestRail::Generators::Project.copy_file("test_rail_data.yml", "config/data/")
|
13
14
|
end
|
14
15
|
|
15
|
-
desc "check_test_run_and_update", "Check test run statuses and update. Set test run id through --test_run_id parameter"
|
16
|
+
desc "check_test_run_and_update", "Check test run statuses and update. Set test run id through --test_run_id parameter, --build_url for adding build url to test run description"
|
16
17
|
option :test_run_id
|
18
|
+
option :build_url
|
19
|
+
|
17
20
|
def check_test_run_and_update
|
18
|
-
if options[:test_run_id]
|
21
|
+
if options[:build_url] && options[:test_run_id]
|
22
|
+
TestRail::Connection.write_build_url(options[:test_run_id], options[:build_url])
|
23
|
+
elsif options[:test_run_id]
|
19
24
|
TestRail::Check.check_test_run_statuses(options[:test_run_id])
|
20
25
|
else
|
21
26
|
puts "You must set correct test run id through --test_run_id"
|
22
27
|
end
|
23
|
-
|
28
|
+
end
|
24
29
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
test_run = TestRail::TestRun.create(test_run_name)
|
34
|
-
puts "You successfully created test run with id #{test_run.id}"
|
35
|
-
end
|
30
|
+
desc "create_test_run", "Create test run with name. Set test run name through --test_run_name parameter"
|
31
|
+
option :test_run_name
|
32
|
+
|
33
|
+
def create_test_run
|
34
|
+
test_run_name = options[:test_run_name]
|
35
|
+
if test_run_name
|
36
|
+
if test_run_name == ''
|
37
|
+
puts "Test_run_name parameter should not be empty"
|
36
38
|
else
|
37
|
-
|
39
|
+
test_run = TestRail::TestRun.create(test_run_name)
|
40
|
+
puts "You successfully created test run with id #{test_run.id}"
|
38
41
|
end
|
42
|
+
else
|
43
|
+
puts "You must set correct test run name through --test_run_name\n"
|
39
44
|
end
|
45
|
+
end
|
40
46
|
|
41
|
-
|
47
|
+
desc "shoot", "Run Test Rail integration with \n
|
42
48
|
--test_run_id for run id,
|
43
49
|
optional:
|
44
50
|
--venture for describing venture,
|
@@ -48,78 +54,80 @@ class CLI < Thor
|
|
48
54
|
--auto for getting env, venture params from test run name,
|
49
55
|
--simple for run without venture and env params,
|
50
56
|
--type to define tests with type to execute."
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
end
|
71
|
-
if parameters[1].nil?
|
72
|
-
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."
|
73
|
-
return
|
74
|
-
end
|
75
|
-
if parameters[2].nil?
|
76
|
-
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."
|
77
|
-
return
|
78
|
-
end
|
79
|
-
if parameters
|
80
|
-
# TODO venture can be everything
|
81
|
-
if options[:venture]
|
82
|
-
command.venture = options[:venture]
|
83
|
-
else
|
84
|
-
command.venture = parameters[1]
|
85
|
-
end
|
86
|
-
command.env = parameters[2]
|
87
|
-
end
|
88
|
-
elsif options[:simple] && !options[:command]
|
89
|
-
puts "You should add command param to execute simple execution"
|
57
|
+
option :test_run_id
|
58
|
+
option :venture
|
59
|
+
option :showroom
|
60
|
+
option :command
|
61
|
+
option :env
|
62
|
+
option :auto
|
63
|
+
option :simple
|
64
|
+
option :type
|
65
|
+
|
66
|
+
def shoot
|
67
|
+
if options[:test_run_id]
|
68
|
+
test_run_id = options[:test_run_id]
|
69
|
+
Connection.test_run_id = test_run_id
|
70
|
+
TestRailTools.write_test_run_id(test_run_id)
|
71
|
+
command = TestRail::Command.new(test_run_id)
|
72
|
+
if options[:auto]
|
73
|
+
parameters = TestRail::TestRun.get_by_id(test_run_id).name.downcase.match(/(#{TestRunParameters::VENTURE_REGEX}) (#{TestRunParameters::ENVIRONMENT_REGEX})*/)
|
74
|
+
if parameters.nil?
|
75
|
+
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."
|
90
76
|
return
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
77
|
+
end
|
78
|
+
if parameters[1].nil?
|
79
|
+
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."
|
80
|
+
return
|
81
|
+
end
|
82
|
+
if parameters[2].nil?
|
83
|
+
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."
|
84
|
+
return
|
85
|
+
end
|
86
|
+
if parameters
|
87
|
+
# TODO venture can be everything
|
88
|
+
if options[:venture]
|
89
|
+
command.venture = options[:venture]
|
90
|
+
else
|
91
|
+
command.venture = parameters[1]
|
103
92
|
end
|
104
|
-
command.
|
105
|
-
command.env = options[:env]
|
93
|
+
command.env = parameters[2]
|
106
94
|
end
|
107
|
-
|
108
|
-
|
95
|
+
elsif options[:simple] && !options[:command]
|
96
|
+
puts "You should add command param to execute simple execution"
|
97
|
+
return
|
98
|
+
elsif !options[:simple] && !options[:command]
|
99
|
+
if options[:venture].nil? && options[:env].nil?
|
100
|
+
puts "You must set correct env, venture params through --env, --venture in order to execute command"
|
101
|
+
return
|
109
102
|
end
|
110
|
-
if options[:
|
111
|
-
|
112
|
-
|
113
|
-
command.command = TestRunParameters::EXEC_COMMAND
|
103
|
+
if options[:venture].nil?
|
104
|
+
puts "You must set correct venture param through --venture in order to execute command"
|
105
|
+
return
|
114
106
|
end
|
115
|
-
if options[:
|
116
|
-
|
107
|
+
if options[:env].nil?
|
108
|
+
puts "You must set correct env param through --env in order to execute command"
|
109
|
+
return
|
117
110
|
end
|
118
|
-
command.
|
119
|
-
command.
|
111
|
+
command.venture = options[:venture]
|
112
|
+
command.env = options[:env]
|
113
|
+
end
|
114
|
+
if options[:env] == "showroom" && options[:showroom]
|
115
|
+
command.env = command.env + " SR='#{options[:showroom]}'"
|
116
|
+
end
|
117
|
+
if options[:command]
|
118
|
+
command.command = options[:command]
|
120
119
|
else
|
121
|
-
|
120
|
+
command.command = TestRunParameters::EXEC_COMMAND
|
122
121
|
end
|
122
|
+
if options[:type]
|
123
|
+
command.type = options[:type].to_i
|
124
|
+
end
|
125
|
+
command.generate
|
126
|
+
command.execute
|
127
|
+
else
|
128
|
+
puts "You must set correct test run id through --test_run_id"
|
123
129
|
end
|
124
130
|
end
|
125
131
|
|
132
|
+
end
|
133
|
+
|
@@ -121,6 +121,9 @@ module TestRail
|
|
121
121
|
case_ids
|
122
122
|
end
|
123
123
|
|
124
|
+
#
|
125
|
+
# Get info about test cases from TestRail
|
126
|
+
#
|
124
127
|
def self.get_case_info(case_id)
|
125
128
|
client.send_get("get_case/#{case_id}")
|
126
129
|
end
|
@@ -135,5 +138,20 @@ module TestRail
|
|
135
138
|
client.send_post("update_run/#{run_id}", {name: new_name})
|
136
139
|
end
|
137
140
|
|
141
|
+
#
|
142
|
+
# Update test run with fields
|
143
|
+
#
|
144
|
+
def self.update_test_run(run_id, name_of_run = nil, description = nil, assigned_to_id = nil )
|
145
|
+
client.send_post("update_run/#{run_id}", {name: name_of_run, description: description, assignedto_id: assigned_to_id})
|
146
|
+
end
|
147
|
+
|
148
|
+
#
|
149
|
+
# Write TeamCity build id to TestRail
|
150
|
+
#
|
151
|
+
def self.write_build_url(test_run_id, build_id)
|
152
|
+
description = "Build url: #{build_id}"
|
153
|
+
update_test_run(test_run_id, nil, description, nil)
|
154
|
+
end
|
155
|
+
|
138
156
|
end
|
139
157
|
end
|
data/spec/cli_spec.rb
CHANGED
@@ -64,6 +64,26 @@ describe CLI do
|
|
64
64
|
|
65
65
|
end
|
66
66
|
|
67
|
+
context 'passing test run id and build url' do
|
68
|
+
before :each do
|
69
|
+
@subject.options = {:build_url => 'http://teamcity.ua/buildnum123', :test_run_id => 12345}
|
70
|
+
end
|
71
|
+
|
72
|
+
after :all do
|
73
|
+
@subject.options.clear
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'should send update command' do
|
77
|
+
expect(TestRail::Connection).to receive(:write_build_url)
|
78
|
+
@subject.check_test_run_and_update
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'should send data to Test Rail' do
|
82
|
+
expect(TestRail::Connection).to receive(:update_test_run).and_return("#{@subject.options[:test_run_id]}, nil, #{@subject.options[:build_url]}, nil")
|
83
|
+
@subject.check_test_run_and_update
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
67
87
|
end
|
68
88
|
|
69
89
|
context 'when executing create_test_run command' do
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kirikami
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|