hiptest-publisher 0.19.4 → 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/lib/hiptest-publisher/cli_options_checker.rb +66 -1
- data/lib/hiptest-publisher/client.rb +19 -1
- data/lib/hiptest-publisher/options_parser.rb +5 -0
- 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: 8be16d9ad9975911593e440094b5493c38370870
|
4
|
+
data.tar.gz: 233ff80ce6528326b565f8cbf799b0fbd7839507
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca2d5fbc8cc85e4dafd7b19e0b8399a686aec32269d460b304037eea9d9868a9879526c2a97958177c335a3a5d58908488f415c204ffd69f42807178cc16b389
|
7
|
+
data.tar.gz: b56d092ec517cc1e23a0e6df5c7af0d54fb1b42af551225621072a58a5e0cde7c2229bf224ccb2703f760de49c08d3100189ce42afa00ceb2d1f8a6457de1f9e
|
data/README.md
CHANGED
@@ -126,6 +126,11 @@ Specific options:
|
|
126
126
|
--[no-]uids Export UIDs (note: can be disabled only for Gherkin-based exports, may cause issue when pushing results back) (default: true)
|
127
127
|
--keep-filenames Keep the same name as in Hiptest for the test files (note: may cause encoding issues) (default: false)
|
128
128
|
--keep-foldernames Keep the same name as in Hiptest for the folders (note: may cause encoding issues) (default: false)
|
129
|
+
--filter-on-scenario-ids Filter on scenario ids (use commas to separate ids when fetching multiple scenarios)
|
130
|
+
--filter-on-folder-ids Filter on folder ids (use commas to separate ids when fetching multiple folders)
|
131
|
+
--filter-on-scenario-name Filter on scenario name (only one name is accepted)
|
132
|
+
--filter-on-folder-name Filter on folder name (only one name is accepted)
|
133
|
+
--filter-on-tags Filter on scenarios and folder tags (use commas to separate tags when using multiple tags)
|
129
134
|
-v, --verbose Run verbosely (default: false)
|
130
135
|
-H, --languages-help Show languages and framework options
|
131
136
|
-h, --help Show this message
|
@@ -21,6 +21,7 @@ module Hiptest
|
|
21
21
|
end
|
22
22
|
|
23
23
|
check_secret_token
|
24
|
+
check_filters
|
24
25
|
|
25
26
|
if cli_options.push?
|
26
27
|
check_push_file
|
@@ -41,6 +42,36 @@ module Hiptest
|
|
41
42
|
end
|
42
43
|
end
|
43
44
|
|
45
|
+
def check_filters
|
46
|
+
filters = [
|
47
|
+
cli_options.filter_on_scenario_ids,
|
48
|
+
cli_options.filter_on_folder_ids,
|
49
|
+
cli_options.filter_on_scenario_name,
|
50
|
+
cli_options.filter_on_folder_name,
|
51
|
+
cli_options.filter_on_tags
|
52
|
+
].reject {|opt| absent?(opt) }
|
53
|
+
|
54
|
+
return if filters.empty?
|
55
|
+
|
56
|
+
if filters.size > 1
|
57
|
+
raise CliOptionError, [
|
58
|
+
"You specified multiple filters for the export.",
|
59
|
+
"",
|
60
|
+
"Only one filter can be applied."
|
61
|
+
].join("\n")
|
62
|
+
end
|
63
|
+
|
64
|
+
if present?(cli_options.test_run_id) || present?(cli_options.test_run_name)
|
65
|
+
raise CliOptionError, [
|
66
|
+
"Filtering can not be applied when exporting from a test run"
|
67
|
+
].join("\n")
|
68
|
+
end
|
69
|
+
|
70
|
+
check_numeric_list(:filter_on_scenario_ids)
|
71
|
+
check_numeric_list(:filter_on_folder_ids)
|
72
|
+
check_tag_list(:filter_on_tags)
|
73
|
+
end
|
74
|
+
|
44
75
|
def check_secret_token
|
45
76
|
if absent?(cli_options.xml_file)
|
46
77
|
if absent?(cli_options.token)
|
@@ -127,6 +158,36 @@ module Hiptest
|
|
127
158
|
end
|
128
159
|
end
|
129
160
|
|
161
|
+
def check_numeric_list(option_name)
|
162
|
+
value = cli_options.send(option_name)
|
163
|
+
return if absent?(value)
|
164
|
+
|
165
|
+
value.split(',').each do |val|
|
166
|
+
next if numeric?(val.strip)
|
167
|
+
|
168
|
+
raise CliOptionError, [
|
169
|
+
"#{option_name} should be a list of comma separated numeric values",
|
170
|
+
"",
|
171
|
+
"Found: #{val.strip.inspect}"
|
172
|
+
].join("\n")
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
def check_tag_list(option_name)
|
177
|
+
value = cli_options.send(option_name)
|
178
|
+
return if absent?(value)
|
179
|
+
|
180
|
+
value.split(',').each do |val|
|
181
|
+
next if tag_compatible?(val.strip)
|
182
|
+
|
183
|
+
raise CliOptionError, [
|
184
|
+
"#{option_name} should be a list of comma separated tags in Hiptest",
|
185
|
+
"",
|
186
|
+
"Found: #{val.strip.inspect}"
|
187
|
+
].join("\n")
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
130
191
|
def check_language_and_only
|
131
192
|
if present?(cli_options.language)
|
132
193
|
begin
|
@@ -153,7 +214,7 @@ module Hiptest
|
|
153
214
|
private
|
154
215
|
|
155
216
|
def numeric?(arg)
|
156
|
-
arg =~
|
217
|
+
arg =~ /\A\d*\z/
|
157
218
|
end
|
158
219
|
|
159
220
|
def missing?(arg)
|
@@ -172,6 +233,10 @@ module Hiptest
|
|
172
233
|
!absent?(arg)
|
173
234
|
end
|
174
235
|
|
236
|
+
def tag_compatible?(value)
|
237
|
+
value =~ /\A[a-zA-Z0-9_-]*(:[a-zA-Z0-9_-]*)?\z/
|
238
|
+
end
|
239
|
+
|
175
240
|
def formatted_categories(categories)
|
176
241
|
formatted_categories = categories.map(&:inspect)
|
177
242
|
if formatted_categories.length == 1
|
@@ -23,10 +23,28 @@ module Hiptest
|
|
23
23
|
elsif test_run_id
|
24
24
|
"#{base_publication_path}/test_run/#{test_run_id}"
|
25
25
|
else
|
26
|
-
"#{base_publication_path}/#{cli_options.leafless_export ? 'leafless_tests' : 'project'}"
|
26
|
+
"#{base_publication_path}/#{cli_options.leafless_export ? 'leafless_tests' : 'project'}#{project_export_filters}"
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
+
def project_export_filters
|
31
|
+
mapping = {
|
32
|
+
filter_on_scenario_ids: 'filter_scenario_ids',
|
33
|
+
filter_on_folder_ids: 'filter_folder_ids',
|
34
|
+
filter_on_scenario_name: 'filter_scenario_name',
|
35
|
+
filter_on_folder_name: 'filter_folder_name',
|
36
|
+
filter_on_tags: 'filter_tags'
|
37
|
+
}
|
38
|
+
|
39
|
+
options = mapping.map do |key, filter_name|
|
40
|
+
value = @cli_options.send(key)
|
41
|
+
next if value.nil? || value.empty?
|
42
|
+
|
43
|
+
"#{filter_name}=#{value}"
|
44
|
+
end.compact
|
45
|
+
return options.empty? ? '' : "?#{options.first}"
|
46
|
+
end
|
47
|
+
|
30
48
|
def fetch_project_export
|
31
49
|
response = send_get_request(url)
|
32
50
|
if response.code_type == Net::HTTPNotFound
|
@@ -198,6 +198,11 @@ class OptionsParser
|
|
198
198
|
Option.new(nil, '[no-]uids', true, nil, 'Export UIDs (note: can be disabled only for Gherkin-based exports, may cause issue when pushing results back)', :uids),
|
199
199
|
Option.new(nil, 'keep-filenames', false, nil, "Keep the same name as in Hiptest for the test files (note: may cause encoding issues)", :keep_filenames),
|
200
200
|
Option.new(nil, 'keep-foldernames', false, nil, "Keep the same name as in Hiptest for the folders (note: may cause encoding issues)", :keep_foldernames),
|
201
|
+
Option.new(nil, 'filter-on-scenario-ids=IDS', '', String, "Filter on scenario ids (use commas to separate ids when fetching multiple scenarios)", :filter_on_scenario_ids),
|
202
|
+
Option.new(nil, 'filter-on-folder-ids=IDS', '', String, "Filter on folder ids (use commas to separate ids when fetching multiple folders)", :filter_on_folder_ids),
|
203
|
+
Option.new(nil, 'filter-on-scenario-name=NAME', '', String, "Filter on scenario name (only one name is accepted)", :filter_on_scenario_name),
|
204
|
+
Option.new(nil, 'filter-on-folder-name=NAME', '', String, "Filter on folder name (only one name is accepted)", :filter_on_folder_name),
|
205
|
+
Option.new(nil, 'filter-on-tags=TAGS', '', String, "Filter on scenarios and folder tags (use commas to separate tags when using multiple tags)", :filter_on_tags),
|
201
206
|
Option.new('v', 'verbose', false, nil, "Run verbosely", :verbose)
|
202
207
|
]
|
203
208
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hiptest-publisher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiptest R&D
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|