hiptest-publisher 0.21.2 → 0.22.0

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: 66d70051b9ee31eb07c62e4b4ee9c4bbaeff4fb5
4
- data.tar.gz: 822e1a2c1a0dd0eec767dfcf1041a31dd6d32b82
3
+ metadata.gz: ed83eeec6f0fb188ad678f7da395f4b6df95f919
4
+ data.tar.gz: 77e075084c0c8d74b179a3f52b6dac4d6167aebc
5
5
  SHA512:
6
- metadata.gz: 0fb7cca9e673ad882baf35b3df9d99262b4059bdd7c2515db2c805121bb53222c022425fca909aedc28b425f53cc71785b6c1680844d71c142d23051deac8115
7
- data.tar.gz: 643a62476439fa765cf00c82127ff115b863013e917947cb2526cea8b4019b00eb5b677f712d5e8bc6e084b5128ded23103e60f737ca8b7e2e896ab6a778c73b
6
+ metadata.gz: 24ee8b3f9751cabb32cbaeb1fb137b3019c86ae28ecd9bf46c96956ac9a128c1c3174e34fc9780f06dbe63f5f2f5d5d55b35f8072bd8401fcc4b2e050a270631
7
+ data.tar.gz: 1792067fd0259691fe2124cf3c61f916e7d4dbf14021c0b12e0cc5bc5ffa604cc3ba7a74f569ee5508cbaab5c9d4cd9a3561ea755c4ba0cf2641685dc8a6664a
@@ -194,32 +194,40 @@ module Hiptest
194
194
  return
195
195
  end
196
196
 
197
+ command_line = @cli_options.command_line_used(exclude: [:actionwords_diff])
198
+
197
199
  unless diff[:deleted].nil?
198
- puts "#{pluralize(diff[:deleted].length, "action word")} deleted:"
200
+ puts "#{pluralize(diff[:deleted].length, "action word")} deleted,"
201
+ puts "run '#{command_line} --show-actionwords-deleted' to list the #{pluralize_word(diff[:deleted].length, "name")} in the code"
199
202
  puts diff[:deleted].map {|d| "- #{d[:name]}"}.join("\n")
200
203
  puts ""
201
204
  end
202
205
 
203
206
  unless diff[:created].nil?
204
- puts "#{pluralize(diff[:created].length, "action word")} created:"
207
+ puts "#{pluralize(diff[:created].length, "action word")} created,"
208
+ puts "run '#{command_line} --show-actionwords-created' to get the #{pluralize_word(diff[:created].length, "definition")}"
209
+
205
210
  puts diff[:created].map {|c| "- #{c[:name]}"}.join("\n")
206
211
  puts ""
207
212
  end
208
213
 
209
214
  unless diff[:renamed].nil?
210
- puts "#{pluralize(diff[:renamed].length, "action word")} renamed:"
215
+ puts "#{pluralize(diff[:renamed].length, "action word")} renamed,"
216
+ puts "run '#{command_line} --show-actionwords-renamed' to get the new #{pluralize_word(diff[:renamed].length, "name")}"
211
217
  puts diff[:renamed].map {|r| "- #{r[:name]} => #{r[:new_name]}"}.join("\n")
212
218
  puts ""
213
219
  end
214
220
 
215
221
  unless diff[:signature_changed].nil?
216
- puts "#{pluralize(diff[:signature_changed].length, "action word")} which signature changed:"
222
+ puts "#{pluralize(diff[:signature_changed].length, "action word")} which signature changed,"
223
+ puts "run '#{command_line} --show-actionwords-signature-changed' to get the new #{pluralize_word(diff[:signature_changed].length, "signature")}"
217
224
  puts diff[:signature_changed].map {|c| "- #{c[:name]}"}.join("\n")
218
225
  puts ""
219
226
  end
220
227
 
221
228
  unless diff[:definition_changed].nil?
222
229
  puts "#{pluralize(diff[:definition_changed].length, "action word")} which definition changed:"
230
+ puts "run '#{command_line} --show-actionwords-definition-changed' to get the new #{pluralize_word(diff[:definition_changed].length, "definition")}"
223
231
  puts diff[:definition_changed].map {|c| "- #{c[:name]}"}.join("\n")
224
232
  puts ""
225
233
  end
@@ -301,8 +309,30 @@ module Hiptest
301
309
  end
302
310
  end
303
311
  end
312
+
313
+ display_empty_push_help if passed_count == 0
304
314
  rescue Exception => err
305
315
  reporter.dump_error(err)
306
316
  end
317
+
318
+ def display_empty_push_help
319
+ command = @cli_options.command_line_used(exclude: [:push, :push_format])
320
+ enhanced_command = "#{command} --without=actionwords"
321
+ if @cli_options.test_run_id.nil? || @cli_options.test_run_id.empty?
322
+ enhanced_command += " --test-run-id=<the ID of the test run you want to push the results to>"
323
+ end
324
+
325
+ puts [
326
+ "Possible causes for the lack of imported tests:",
327
+ "",
328
+ " * Did you run the following command before executing your tests ?",
329
+ " #{enhanced_command}",
330
+ "",
331
+ " * Did you specify the correct push format ?",
332
+ " Use push_format=<format> in your config file or option --push-format=<format> in the command line",
333
+ " Available formats are: tap, junit, robot, nunit",
334
+ ""
335
+ ].join("\n")
336
+ end
307
337
  end
308
338
  end
@@ -106,6 +106,15 @@ class CliOptions < OpenStruct
106
106
  only.split(",") if only
107
107
  end
108
108
 
109
+ def command_line_used(exclude: [])
110
+ args = self.__cli_args.map do |key|
111
+ next if exclude.include?(key)
112
+ "--#{key.to_s.gsub('_', '-')}=#{self[key]}"
113
+ end.compact
114
+
115
+ return "hiptest-publisher #{args.join(' ')}".strip
116
+ end
117
+
109
118
  def normalize!(reporter = nil)
110
119
  self.no_uids = !uids # silent normalization
111
120
  modified_options = self.clone
@@ -127,6 +136,15 @@ class CliOptions < OpenStruct
127
136
  end
128
137
  end
129
138
 
139
+ if without
140
+ begin
141
+ available_groups = LanguageConfigParser.new(modified_options).filtered_group_names
142
+ modified_options.only = (available_groups - without.split(',')).join(',')
143
+ rescue ArgumentError
144
+ # Ok, that will be handled by cli_options_checkers later on
145
+ end
146
+ end
147
+
130
148
  if self != modified_options
131
149
  delta = modified_options.table.select do |key, value|
132
150
  modified_options[key] != self[key]
@@ -178,6 +196,7 @@ class OptionsParser
178
196
  Option.new(nil, 'test-run-id=ID', '', String, "Export data from a test run identified by its id", :test_run_id),
179
197
  Option.new(nil, 'test-run-name=NAME', '', String, "Export data from a test run identified by its name", :test_run_name),
180
198
  Option.new(nil, 'only=CATEGORIES', nil, String, "Restrict export to given file categories (--only=list to list them)", :only),
199
+ Option.new(nil, 'without=CATEGORIES', nil, String, "Exclude file categories from import (--only=list to list them)", :only),
181
200
  Option.new('x', 'xml-file=PROJECT_XML', nil, String, "XML file to use instead of fetching it from Hiptest", :xml_file),
182
201
  Option.new(nil, 'tests-only', false, nil, "(deprecated) alias for --only=tests", :tests_only),
183
202
  Option.new(nil, 'actionwords-only', false, nil, "(deprecated) alias for --only=actionwords", :actionwords_only),
@@ -15,9 +15,10 @@ module Hiptest
15
15
 
16
16
  compute_created
17
17
  compute_deleted
18
- compute_renamed
19
- compute_signature_changed
18
+
20
19
  compute_definition_changed
20
+ compute_signature_changed
21
+ compute_renamed
21
22
 
22
23
  diff = {}
23
24
  diff[:created] = @created unless @created.empty?
@@ -42,8 +43,15 @@ module Hiptest
42
43
  end
43
44
 
44
45
  def compute_renamed
46
+ excluded = [
47
+ @created_uids,
48
+ @deleted_uids,
49
+ @definition_changed_uids,
50
+ @signature_changed_uids
51
+ ].flatten.uniq
52
+
45
53
  @renamed = @current_uid.map do |uid, aw|
46
- next if @created_uids.include?(uid) || @deleted_uids.include?(uid)
54
+ next if excluded.include?(uid)
47
55
  next if @old_uid[uid]['name'] == aw['name']
48
56
 
49
57
  {name: @old_uid[uid]['name'], new_name: aw['name'], node: aw['node']}
@@ -51,20 +59,31 @@ module Hiptest
51
59
  end
52
60
 
53
61
  def compute_signature_changed
62
+ excluded = [
63
+ @created_uids,
64
+ @deleted_uids,
65
+ @definition_changed_uids
66
+ ].flatten.uniq
67
+
68
+ @signature_changed_uids = []
54
69
  @signature_changed = @current_uid.map do |uid, aw|
55
- next if @created_uids.include?(uid) || @deleted_uids.include?(uid)
70
+ next if excluded.include?(uid)
56
71
  next if @old_uid[uid]['parameters'] == aw['parameters']
57
72
 
73
+ @signature_changed_uids << uid
58
74
  {name: aw['name'], node: aw['node']}
59
75
  end.compact
60
76
  end
61
77
 
62
78
  def compute_definition_changed
79
+ @definition_changed_uids = []
80
+
63
81
  @definition_changed = @current_uid.map do |uid, aw|
64
82
  next if @old_uid[uid].nil?
65
83
  next unless @old_uid[uid].has_key?('body_hash')
66
84
  next if aw['body_hash'] == @old_uid[uid]['body_hash']
67
85
 
86
+ @definition_changed_uids << uid
68
87
  {name: aw['name'], node: aw['node']}
69
88
  end.compact
70
89
  end
@@ -73,4 +92,4 @@ module Hiptest
73
92
  Hash[actionwords.collect { |aw| [aw['uid'], aw] }]
74
93
  end
75
94
  end
76
- end
95
+ 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.21.2
4
+ version: 0.22.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-03-13 00:00:00.000000000 Z
11
+ date: 2017-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize