hiptest-publisher 1.22.0 → 1.23.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +5 -5
  2. data/lib/hiptest-publisher/indexers/actionword_indexer.rb +0 -6
  3. data/lib/hiptest-publisher/indexers/library_actionword_indexer.rb +32 -0
  4. data/lib/hiptest-publisher/node_modifiers/actionword_uniq_renamer.rb +4 -4
  5. data/lib/hiptest-publisher/node_modifiers/add_all.rb +0 -2
  6. data/lib/hiptest-publisher/node_modifiers/call_arguments_adder.rb +6 -12
  7. data/lib/hiptest-publisher/node_modifiers/gherkin_adder.rb +10 -2
  8. data/lib/hiptest-publisher/node_modifiers/parameter_type_adder.rb +2 -2
  9. data/lib/hiptest-publisher/nodes.rb +20 -30
  10. data/lib/hiptest-publisher/render_context_maker.rb +8 -12
  11. data/lib/hiptest-publisher/renderer_addons/gherkin_addon.rb +0 -12
  12. data/lib/hiptest-publisher/renderer_addons/groovy_spock_addon.rb +1 -7
  13. data/lib/hiptest-publisher/signature_exporter.rb +1 -1
  14. data/lib/hiptest-publisher/xml_parser.rb +10 -8
  15. data/lib/templates/behat/actionword.hbs +1 -1
  16. data/lib/templates/behat/library.hbs +1 -1
  17. data/lib/templates/behat/libraryactionword.hbs +8 -0
  18. data/lib/templates/cucumber/groovy/step-definitions/actionword.hbs +1 -1
  19. data/lib/templates/cucumber/groovy/step-definitions/library.hbs +1 -1
  20. data/lib/templates/cucumber/groovy/step-definitions/libraryactionword.hbs +5 -0
  21. data/lib/templates/groovy/call.hbs +1 -1
  22. data/lib/templates/groovy/library.hbs +1 -1
  23. data/lib/templates/groovy/libraryactionword.hbs +2 -0
  24. data/lib/templates/java/call.hbs +1 -1
  25. data/lib/templates/java/library.hbs +1 -1
  26. data/lib/templates/java/libraryactionword.hbs +1 -0
  27. data/lib/templates/php/call.hbs +1 -1
  28. data/lib/templates/php/library.hbs +1 -1
  29. data/lib/templates/php/libraryactionword.hbs +1 -0
  30. metadata +9 -9
  31. data/lib/hiptest-publisher/indexers/actionword_uid_indexer.rb +0 -34
  32. data/lib/hiptest-publisher/node_modifiers/uid_call_reference_adder.rb +0 -30
  33. data/lib/templates/gherkin/uidcall.hbs +0 -1
  34. data/lib/templates/groovy/uidcall.hbs +0 -2
  35. data/lib/templates/java/uidcall.hbs +0 -1
  36. data/lib/templates/php/uidcall.hbs +0 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6cdf69058942b8d31c0cf0bb28be35c1fe96f22c
4
- data.tar.gz: 78a1e2f929a5de1053f56274c6555984c0136db0
2
+ SHA256:
3
+ metadata.gz: dd655143571daad59fa1d3e46c7d7d486d0f7082a27a79672c7432cf3dafe2f9
4
+ data.tar.gz: 6dca3a65541bb3dbb8be9aedb57ec357b9e5d4f92a710268b8fb95a9ce270dc7
5
5
  SHA512:
6
- metadata.gz: '079b4604dc8f521a72a4985837cd9cd280783337c8a68ff6c2450ed0d315625fc7d898dfc3b6873fd5ec463a2db4991987eb82a86f43e93d2e1e828cdd178905'
7
- data.tar.gz: 695075f59e61603b8972a0c40499f7ed42f04c48edbce740f46edfb534a05f3431c5ef0c1f9a93d83782943e0e8f327fe9bba9b6a7b6372b7430379a70fc2d82
6
+ metadata.gz: a2f7b9d87e0a8cf5e62fd08004d07cbf58422cdc1406f676709a32ebf344af3d57f91caad5a8503c918a9bb21a61931189134b08fc00fc1ccc39592712a704c7
7
+ data.tar.gz: ba8ce3d545f8f6c6e1f8d2ceb7205f0e63f54063c2696d66e2a7f55bfbfa6407191206c30b1d47d65bf2ec43e5f2ae911df32462fb797243b3f4a465ad47e284
@@ -3,7 +3,6 @@ module Hiptest
3
3
  def initialize(project)
4
4
  @project = project
5
5
  @indexed = {}
6
- @uid_indexed = {}
7
6
  index_actionwords
8
7
  end
9
8
 
@@ -23,16 +22,11 @@ module Hiptest
23
22
  }
24
23
 
25
24
  @indexed[aw_name] = data
26
- @uid_indexed[aw.children[:uid]] = data
27
25
  end
28
26
  end
29
27
 
30
28
  def get_index(name)
31
29
  @indexed[name]
32
30
  end
33
-
34
- def get_uid_index(uid)
35
- @uid_indexed[uid]
36
- end
37
31
  end
38
32
  end
@@ -0,0 +1,32 @@
1
+ module Hiptest
2
+ class LibraryActionwordIndexer
3
+ def initialize(project)
4
+ @project = project
5
+ @indexed = {}
6
+ index_library_actionwords
7
+ end
8
+
9
+ def index_library_actionwords
10
+ @project.each_sub_nodes(Hiptest::Nodes::LibraryActionword) do |aw|
11
+ aw_name = aw.children[:name]
12
+ indexed_parameters = {}
13
+
14
+ aw.children[:parameters].map do |param|
15
+ param_name = param.children[:name]
16
+ indexed_parameters[param_name] = param.children[:default]
17
+ end
18
+
19
+ data = {
20
+ actionword: aw,
21
+ parameters: indexed_parameters
22
+ }
23
+
24
+ @indexed[aw_name] = data
25
+ end
26
+ end
27
+
28
+ def get_index(name)
29
+ @indexed[name]
30
+ end
31
+ end
32
+ end
@@ -11,10 +11,10 @@ module Hiptest
11
11
 
12
12
  def make_uniq_names
13
13
  @project.children[:libraries].children[:libraries].each do |library|
14
- library.children[:actionwords].each do |actionword|
15
- existing_names = library.children[:actionwords].reject{|aw| aw == actionword}.map(&:uniq_name)
16
- new_name = find_uniq_name(actionword.children[:name], existing_names)
17
- actionword.uniq_name = new_name
14
+ library.children[:library_actionwords].each do |library_actionword|
15
+ existing_names = library.children[:library_actionwords].reject{|aw| aw == library_actionword}.map(&:uniq_name)
16
+ new_name = find_uniq_name(library_actionword.children[:name], existing_names)
17
+ library_actionword.uniq_name = new_name
18
18
  end
19
19
  end
20
20
  end
@@ -5,14 +5,12 @@ require 'hiptest-publisher/node_modifiers/gherkin_adder'
5
5
  require 'hiptest-publisher/node_modifiers/items_orderer'
6
6
  require 'hiptest-publisher/node_modifiers/parameter_type_adder'
7
7
  require 'hiptest-publisher/node_modifiers/parent_adder'
8
- require 'hiptest-publisher/node_modifiers/uid_call_reference_adder'
9
8
 
10
9
  module Hiptest
11
10
  module NodeModifiers
12
11
  def self.add_all(project, sort_method = nil)
13
12
  DatatableFixer.add(project)
14
13
  ParentAdder.add(project)
15
- UidCallReferencerAdder.add(project)
16
14
  ParameterTypeAdder.add(project)
17
15
  DefaultArgumentAdder.add(project)
18
16
  ActionwordUniqRenamer.add(project)
@@ -1,32 +1,26 @@
1
1
  require 'hiptest-publisher/indexers/actionword_indexer'
2
+ require 'hiptest-publisher/indexers/library_actionword_indexer'
2
3
  require 'hiptest-publisher/nodes'
3
4
 
4
5
  module Hiptest
5
6
  module NodeModifiers
6
7
  class DefaultArgumentAdder
7
8
  def self.add(project)
8
- self.new(project).update_all_calls
9
+ self.new(project).update_calls
9
10
  end
10
11
 
11
12
  def initialize(project)
12
13
  @project = project
14
+ @library_indexer = LibraryActionwordIndexer.new(project)
13
15
  @indexer = ActionwordIndexer.new(project)
14
16
  end
15
17
 
16
- def update_all_calls
17
- update_calls
18
- update_uid_calls
19
- end
20
-
21
18
  def update_calls
22
19
  @project.each_sub_nodes(Hiptest::Nodes::Call) do |call|
23
- update_call(call, @indexer.get_index(call.children[:actionword]))
24
- end
25
- end
20
+ actionword = @library_indexer.get_index(call.children[:actionword])
21
+ actionword = @indexer.get_index(call.children[:actionword]) if actionword.nil?
26
22
 
27
- def update_uid_calls
28
- @project.each_sub_nodes(Hiptest::Nodes::UIDCall) do |uid_call|
29
- update_call(uid_call, @indexer.get_uid_index(uid_call.children[:uid]))
23
+ update_call(call, actionword)
30
24
  end
31
25
  end
32
26
 
@@ -1,4 +1,5 @@
1
1
  require 'hiptest-publisher/indexers/actionword_indexer'
2
+ require 'hiptest-publisher/indexers/library_actionword_indexer'
2
3
  require 'hiptest-publisher/nodes'
3
4
 
4
5
  module Hiptest
@@ -11,6 +12,7 @@ module Hiptest
11
12
  def initialize(project)
12
13
  @project = project
13
14
  @indexer = ActionwordIndexer.new(project)
15
+ @library_indexer = LibraryActionwordIndexer.new(project)
14
16
  @annotations_counter = AnnotationsCounter.new
15
17
 
16
18
  @special_params = ['__free_text', '__datatable']
@@ -19,11 +21,14 @@ module Hiptest
19
21
  def update_calls
20
22
  @project.each_sub_nodes(Hiptest::Nodes::Scenario, Hiptest::Nodes::Actionword, Hiptest::Nodes::Test, Hiptest::Nodes::Folder) do |item|
21
23
  @last_annotation = nil
22
- item.each_sub_nodes(Hiptest::Nodes::Call, Hiptest::Nodes::UIDCall) do |call|
24
+ item.each_sub_nodes(Hiptest::Nodes::Call) do |call|
23
25
  set_call_chunks(call)
24
26
  call.children[:gherkin_text] ||= "#{text_annotation(call)} #{prettified(call)}"
25
27
 
26
28
  if actionword = get_actionword(call)
29
+ if actionword.is_a?(Hiptest::Nodes::LibraryActionword)
30
+ call.children[:library_name] = actionword.parent.children[:name]
31
+ end
27
32
  @annotations_counter.increment(actionword, code_annotation(call))
28
33
  set_actionwords_chunks(actionword)
29
34
 
@@ -187,8 +192,11 @@ module Hiptest
187
192
  end
188
193
 
189
194
  def get_actionword(call)
195
+ actionword = @library_indexer.get_index(call.children[:actionword])
190
196
 
191
- actionword = call.is_a?(Hiptest::Nodes::UIDCall) ? @indexer.get_uid_index(call.children[:uid]) : @indexer.get_index(call.children[:actionword])
197
+ if actionword.nil?
198
+ actionword = @indexer.get_index(call.children[:actionword])
199
+ end
192
200
 
193
201
  actionword && actionword[:actionword] || nil
194
202
  end
@@ -49,8 +49,8 @@ module Hiptest
49
49
  end
50
50
 
51
51
  def gather_call_argument_types(node)
52
- node.each_sub_nodes(Hiptest::Nodes::Call, Hiptest::Nodes::UIDCall) do |call|
53
- actionword_name = call.is_a?(Hiptest::Nodes::Call) ? call.children[:actionword] : call.children[:actionword_name]
52
+ node.each_sub_nodes(Hiptest::Nodes::Call) do |call|
53
+ actionword_name = call.children[:actionword]
54
54
 
55
55
  @call_types.add_callable_item(actionword_name, Hiptest::Nodes::Actionword)
56
56
  add_arguments_from(call, node)
@@ -235,34 +235,6 @@ module Hiptest
235
235
  end
236
236
  end
237
237
 
238
- class UIDCall < Node
239
- attr_reader :chunks, :extra_inlined_arguments
240
- attr_writer :chunks, :extra_inlined_arguments
241
-
242
- def initialize(uid, arguments = [], annotation = nil)
243
- super()
244
- annotation = nil if annotation == ''
245
-
246
- @children = {
247
- uid: uid,
248
- arguments: arguments,
249
- all_arguments: arguments,
250
- annotation: annotation
251
- }
252
-
253
- @chunks = []
254
- @extra_inlined_arguments = []
255
- end
256
-
257
- def free_text_arg
258
- children[:arguments].find(&:free_text?)
259
- end
260
-
261
- def datatable_arg
262
- children[:arguments].find(&:datatable?)
263
- end
264
- end
265
-
266
238
  class IfThen < Node
267
239
  def initialize(condition, then_, else_ = [])
268
240
  super()
@@ -370,6 +342,24 @@ module Hiptest
370
342
  end
371
343
  end
372
344
 
345
+ class LibraryActionword < Item
346
+ attr_reader :chunks, :extra_inlined_parameters, :uniq_name
347
+ attr_writer :chunks, :extra_inlined_parameters, :uniq_name
348
+
349
+ def initialize(name, tags = [], parameters = [], body = [], uid = nil, description = '')
350
+ super(name, tags, description, parameters, body)
351
+ @children[:uid] = uid
352
+
353
+ @chunks = []
354
+ @extra_inlined_parameters = []
355
+ @uniq_name = name
356
+ end
357
+
358
+ def must_be_implemented?
359
+ @children[:body].empty? || @children[:body].map {|step| step.class}.compact.include?(Hiptest::Nodes::Step)
360
+ end
361
+ end
362
+
373
363
  class Scenario < Item
374
364
  attr_reader :folder_uid, :order_in_parent
375
365
 
@@ -567,11 +557,11 @@ module Hiptest
567
557
  end
568
558
 
569
559
  class Library < Node
570
- def initialize(name = 'default_library', actionwords = [])
560
+ def initialize(name = 'default_library', library_actionwords = [])
571
561
  super()
572
562
  @children = {
573
563
  name: name,
574
- actionwords: actionwords
564
+ library_actionwords: library_actionwords
575
565
  }
576
566
  end
577
567
  end
@@ -28,9 +28,7 @@ module Hiptest
28
28
  extra_inlined_parameters: aw.extra_inlined_parameters || [],
29
29
  has_free_text_parameter?: aw.children[:parameters].select(&:free_text?).count > 0,
30
30
  has_datatable_parameter?: aw.children[:parameters].select(&:datatable?).count > 0,
31
- uniq_name: aw.uniq_name,
32
- has_library?: (aw.parent.is_a? Hiptest::Nodes::Library) ? true : false,
33
- library_name: aw.parent.nil? ? '' : aw.parent.children[:name]
31
+ uniq_name: aw.uniq_name
34
32
  )
35
33
  end
36
34
 
@@ -101,6 +99,7 @@ module Hiptest
101
99
  {
102
100
  has_arguments?: !c.children[:arguments].empty?,
103
101
  has_annotation?: !c.children[:annotation].nil?,
102
+ is_shared?: !c.children[:library_name].nil?,
104
103
  in_actionword?: c.parent.is_a?(Hiptest::Nodes::Actionword),
105
104
  in_datatabled_scenario?: c.parent.is_a?(Hiptest::Nodes::Scenario) && has_datasets?(c.parent),
106
105
  chunks: c.chunks || [],
@@ -108,15 +107,6 @@ module Hiptest
108
107
  }
109
108
  end
110
109
 
111
- def walk_uidcall(uidcall)
112
- {
113
- has_library?: !uidcall.children[:library_name].nil?,
114
- has_annotation?: !uidcall.children[:annotation].nil?,
115
- in_actionword?: uidcall.parent.is_a?(Hiptest::Nodes::Actionword),
116
- chunks: uidcall.chunks || []
117
- }
118
- end
119
-
120
110
  def walk_ifthen(it)
121
111
  {
122
112
  has_else?: !it.children[:else].empty?
@@ -153,6 +143,12 @@ module Hiptest
153
143
  }
154
144
  end
155
145
 
146
+ def walk_libraryactionword(aw)
147
+ walk_actionword(aw).merge(
148
+ library_name: aw.parent.children[:name]
149
+ )
150
+ end
151
+
156
152
  def walk_libraries(libraries)
157
153
  {
158
154
  library_names: libraries.children[:libraries].map {|lib| lib.children[:name]}
@@ -14,18 +14,6 @@ module Hiptest
14
14
  super(call)
15
15
  end
16
16
 
17
- def walk_uidcall(call)
18
- if call.free_text_arg
19
- @rendered_children[:free_text_arg] = rendered_freetext_arg(call)
20
- end
21
-
22
- if call.datatable_arg
23
- @rendered_children[:datatable_arg] = rendered_datatable_arg(call)
24
- end
25
-
26
- super(call)
27
- end
28
-
29
17
  def walk_folder(folder)
30
18
  @rendered_children[:ancestor_tags] = ancestor_tags(folder)
31
19
 
@@ -7,12 +7,6 @@ module Hiptest
7
7
  use_annotation(call, base)
8
8
  end
9
9
 
10
- def walk_uidcall(uidcall)
11
- base = super(uidcall)
12
- use_annotation(uidcall, base)
13
- end
14
-
15
-
16
10
  private
17
11
 
18
12
  def use_annotation(call, base)
@@ -29,7 +23,7 @@ module Hiptest
29
23
  return false unless call.children[:annotation].nil? || ignore_case_equal?(call.children[:annotation], 'then')
30
24
 
31
25
  return call.parent.children[:body].select do |step|
32
- (step.is_a?(Hiptest::Nodes::Call) || step.is_a?(Hiptest::Nodes::UIDCall)) && !step.children[:annotation].nil? && ignore_case_equal?(step.children[:annotation], 'when')
26
+ step.is_a?(Hiptest::Nodes::Call) && !step.children[:annotation].nil? && ignore_case_equal?(step.children[:annotation], 'when')
33
27
  end.empty?
34
28
  end
35
29
 
@@ -24,7 +24,7 @@ module Hiptest
24
24
  {
25
25
  'name' => library.children[:name],
26
26
  'type' => 'library',
27
- 'actionwords' => library.children[:actionwords].map {|aw| export_actionword(aw, export_nodes) }
27
+ 'actionwords' => library.children[:library_actionwords].map {|aw| export_actionword(aw, export_nodes) }
28
28
  }
29
29
  end
30
30
 
@@ -122,13 +122,6 @@ module Hiptest
122
122
  css_first_content(call, '> annotation'))
123
123
  end
124
124
 
125
- def build_uidcall(uid_call)
126
- Hiptest::Nodes::UIDCall.new(
127
- css_first_content(uid_call, '> uid'),
128
- build_arguments(uid_call),
129
- css_first_content(uid_call, '> annotation'))
130
- end
131
-
132
125
  def build_arguments(arguments)
133
126
  build_node_list(arguments.css('> arguments > argument'))
134
127
  end
@@ -205,7 +198,16 @@ module Hiptest
205
198
  css_first_content(actionword, '> uid'),
206
199
  css_first_content(actionword, '> description'))
207
200
  end
208
- alias :build_libraryActionword :build_actionword
201
+
202
+ def build_libraryActionword(libraryActionword)
203
+ Hiptest::Nodes::LibraryActionword.new(
204
+ css_first_content(libraryActionword, '> name'),
205
+ build_tags(libraryActionword),
206
+ build_parameters(libraryActionword),
207
+ build_steps(libraryActionword),
208
+ css_first_content(libraryActionword, '> uid'),
209
+ css_first_content(libraryActionword, '> description'))
210
+ end
209
211
 
210
212
  def build_actionwordSnapshot(actionword)
211
213
  Hiptest::Nodes::Actionword.new(
@@ -3,6 +3,6 @@
3
3
  * @{{{ rendered_children.gherkin_annotation }}} /{{> gherkin_pattern}}/
4
4
  */
5
5
  public function {{{ camelize_lower rendered_children.name }}}({{#if has_parameters?}}{{{ join rendered_children.parameters_ordered_by_pattern ', '}}}{{/if}}){{#curly}}{{#indent}}
6
- $this->actionwords->{{#if has_library?}}get{{{camelize library_name}}}Library()->{{/if}}{{{ camelize_lower rendered_children.name }}}({{#if has_parameters?}}{{#join raw_parameter_names ', '}}${{{underscore this}}}{{/join}}{{/if}});
6
+ $this->actionwords->{{{ camelize_lower rendered_children.name }}}({{#if has_parameters?}}{{#join raw_parameter_names ', '}}${{{underscore this}}}{{/join}}{{/if}});
7
7
  {{/indent}}
8
8
  {{/curly}}{{/if}}
@@ -10,7 +10,7 @@ class {{camelize rendered_children.name}}FeatureContext implements SnippetAccept
10
10
  public function __construct() {{#curly}}{{#indent}}
11
11
  $this->actionwords = new Actionwords();{{/indent}}
12
12
  {{/curly}}
13
- {{#each rendered_children.actionwords}}
13
+ {{#each rendered_children.library_actionwords}}
14
14
  {{{this}}}{{/each}}{{/indent}}
15
15
  {{/curly}}
16
16
  ?>
@@ -0,0 +1,8 @@
1
+ {{#if rendered_children.gherkin_annotation }}
2
+ /**
3
+ * @{{{ rendered_children.gherkin_annotation }}} /{{> gherkin_pattern}}/
4
+ */
5
+ public function {{{ camelize_lower rendered_children.name }}}({{#if has_parameters?}}{{{ join rendered_children.parameters_ordered_by_pattern ', '}}}{{/if}}){{#curly}}{{#indent}}
6
+ $this->actionwords->get{{{camelize library_name}}}Library()->{{{ camelize_lower rendered_children.name }}}({{#if has_parameters?}}{{#join raw_parameter_names ', '}}${{{underscore this}}}{{/join}}{{/if}});
7
+ {{/indent}}
8
+ {{/curly}}{{/if}}
@@ -1,5 +1,5 @@
1
1
  {{#if rendered_children.gherkin_annotation }}{{{ rendered_children.gherkin_annotation }}}(~"^{{#escape_backslashes_and_double_quotes}}{{> gherkin_pattern}}{{/escape_backslashes_and_double_quotes}}\$") {{#curly}} {{{ join rendered_children.parameters_ordered_by_pattern ', '}}} ->{{#indent}}
2
- {{{ context.call_prefix }}}.{{#if has_library?}}get{{{camelize library_name}}}Library().{{/if}}{{{camelize_lower uniq_name}}}({{#if has_parameters?}}{{#join raw_parameter_names ', '}}{{{camelize_lower this}}}{{/join}}{{/if}})
2
+ {{{ context.call_prefix }}}.{{{camelize_lower uniq_name}}}({{#if has_parameters?}}{{#join raw_parameter_names ', '}}{{{camelize_lower this}}}{{/join}}{{/if}})
3
3
  {{/indent}}
4
4
  {{/curly}}
5
5
  {{/if}}
@@ -6,5 +6,5 @@ this.metaClass.mixin(cucumber.api.groovy.EN)
6
6
 
7
7
  Actionwords {{{ context.call_prefix }}} = new Actionwords()
8
8
 
9
- {{#each rendered_children.actionwords}}{{{this}}}
9
+ {{#each rendered_children.library_actionwords}}{{{this}}}
10
10
  {{/each}}
@@ -0,0 +1,5 @@
1
+ {{#if rendered_children.gherkin_annotation }}{{{ rendered_children.gherkin_annotation }}}(~"^{{#escape_backslashes_and_double_quotes}}{{> gherkin_pattern}}{{/escape_backslashes_and_double_quotes}}\$") {{#curly}} {{{ join rendered_children.parameters_ordered_by_pattern ', '}}} ->{{#indent}}
2
+ {{{ context.call_prefix }}}.get{{{camelize library_name}}}Library().{{{camelize_lower uniq_name}}}({{#if has_parameters?}}{{#join raw_parameter_names ', '}}{{{camelize_lower this}}}{{/join}}{{/if}})
3
+ {{/indent}}
4
+ {{/curly}}
5
+ {{/if}}
@@ -1,2 +1,2 @@
1
1
  {{#unless in_actionword?}}{{#if use_main_annotation?}}{{#if use_expect_annotation}}expect{{else}}{{rendered_children.annotation}}{{/if}}:
2
- {{/if}}{{/unless}}{{#if context.call_prefix}}{{{context.call_prefix}}}.{{/if}}{{{ camelize_lower rendered_children.actionword }}}({{{ join rendered_children.all_arguments ', '}}})
2
+ {{/if}}{{/unless}}{{#if context.call_prefix}}{{{context.call_prefix}}}.{{/if}}{{#if is_shared?}}get{{camelize rendered_children.library_name}}Library().{{/if}}{{{ camelize_lower rendered_children.actionword }}}({{{ join rendered_children.all_arguments ', '}}})
@@ -1,7 +1,7 @@
1
1
  package {{{ context.package }}}
2
2
 
3
3
  @Singleton
4
- class {{camelize rendered_children.name}}Library {{#curly}}{{#indent}}{{#each rendered_children.actionwords}}
4
+ class {{camelize rendered_children.name}}Library {{#curly}}{{#indent}}{{#each rendered_children.library_actionwords}}
5
5
  {{{this}}}
6
6
  {{/each}}
7
7
  {{/indent}}
@@ -0,0 +1,2 @@
1
+ def {{{camelize_lower uniq_name }}}({{#if has_parameters?}}{{{join rendered_children.parameters ', '}}}{{/if}}) {{#curly}}{{#indent}}{{> desc}}{{> steps}}{{/indent}}
2
+ {{/curly}}
@@ -1,2 +1,2 @@
1
1
  {{#if has_annotation? }}{{#comment '//'}}{{{ rendered_children.gherkin_text }}}{{/comment}}
2
- {{/if}}{{#if context.call_prefix}}{{{context.call_prefix}}}.{{/if}}{{{ camelize_lower rendered_children.actionword }}}({{{ join rendered_children.all_arguments ', '}}});
2
+ {{/if}}{{#if context.call_prefix}}{{{context.call_prefix}}}.{{/if}}{{#if is_shared?}}get{{camelize rendered_children.library_name}}Library().{{/if}}{{{ camelize_lower rendered_children.actionword }}}({{{ join rendered_children.all_arguments ', '}}});
@@ -1,6 +1,6 @@
1
1
  package {{{ context.package }}};
2
2
 
3
- public class {{camelize rendered_children.name}}Library extends ActionwordLibrary {{#curly}}{{#indent}}{{#each rendered_children.actionwords}}
3
+ public class {{camelize rendered_children.name}}Library extends ActionwordLibrary {{#curly}}{{#indent}}{{#each rendered_children.library_actionwords}}
4
4
  {{{this}}}
5
5
  {{/each}}
6
6
  {{/indent}}
@@ -0,0 +1 @@
1
+ {{> item_as_function}}
@@ -1,2 +1,2 @@
1
1
  {{#if has_annotation? }}{{#comment '//'}}{{{ rendered_children.gherkin_text }}}{{/comment}}
2
- {{/if}}{{#if context.call_prefix}}{{{ context.call_prefix }}}->{{/if}}{{{ camelize_lower rendered_children.actionword }}}({{{ join rendered_children.all_arguments ', '}}});
2
+ {{/if}}{{#if context.call_prefix}}{{{ context.call_prefix }}}->{{/if}}{{#if is_shared?}}get{{{camelize rendered_children.library_name}}}Library()->{{/if}}{{{ camelize_lower rendered_children.actionword }}}({{{ join rendered_children.all_arguments ', '}}});
@@ -12,7 +12,7 @@ self::$_instance = new {{camelize rendered_children.name}}Library();
12
12
  return self::$_instance;
13
13
  {{/indent}}
14
14
  {{/curly}}
15
- {{#each rendered_children.actionwords}}
15
+ {{#each rendered_children.library_actionwords}}
16
16
  {{{this}}}
17
17
  {{/each}}
18
18
  {{/indent}}
@@ -0,0 +1 @@
1
+ {{> item_as_function }}
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: 1.22.0
4
+ version: 1.23.1
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: 2019-04-30 00:00:00.000000000 Z
11
+ date: 2019-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -252,7 +252,7 @@ files:
252
252
  - lib/hiptest-publisher/formatters/reporter.rb
253
253
  - lib/hiptest-publisher/handlebars_helper.rb
254
254
  - lib/hiptest-publisher/indexers/actionword_indexer.rb
255
- - lib/hiptest-publisher/indexers/actionword_uid_indexer.rb
255
+ - lib/hiptest-publisher/indexers/library_actionword_indexer.rb
256
256
  - lib/hiptest-publisher/node_modifiers/actionword_uniq_renamer.rb
257
257
  - lib/hiptest-publisher/node_modifiers/add_all.rb
258
258
  - lib/hiptest-publisher/node_modifiers/call_arguments_adder.rb
@@ -261,7 +261,6 @@ files:
261
261
  - lib/hiptest-publisher/node_modifiers/items_orderer.rb
262
262
  - lib/hiptest-publisher/node_modifiers/parameter_type_adder.rb
263
263
  - lib/hiptest-publisher/node_modifiers/parent_adder.rb
264
- - lib/hiptest-publisher/node_modifiers/uid_call_reference_adder.rb
265
264
  - lib/hiptest-publisher/nodes.rb
266
265
  - lib/hiptest-publisher/nodes_walker.rb
267
266
  - lib/hiptest-publisher/options_parser.rb
@@ -282,6 +281,7 @@ files:
282
281
  - lib/templates/behat/actionwords.hbs
283
282
  - lib/templates/behat/actionwords/parameter.hbs
284
283
  - lib/templates/behat/library.hbs
284
+ - lib/templates/behat/libraryactionword.hbs
285
285
  - lib/templates/behat/parameter.hbs
286
286
  - lib/templates/behave/actionword.hbs
287
287
  - lib/templates/behave/actionwords.hbs
@@ -334,6 +334,7 @@ files:
334
334
  - lib/templates/cucumber/groovy/step-definitions/actionword.hbs
335
335
  - lib/templates/cucumber/groovy/step-definitions/actionwords.hbs
336
336
  - lib/templates/cucumber/groovy/step-definitions/library.hbs
337
+ - lib/templates/cucumber/groovy/step-definitions/libraryactionword.hbs
337
338
  - lib/templates/cucumber/groovy/step-definitions/parameter.hbs
338
339
  - lib/templates/cucumber/java/actionword.hbs
339
340
  - lib/templates/cucumber/java/actionwords.hbs
@@ -367,7 +368,6 @@ files:
367
368
  - lib/templates/gherkin/stringliteral.hbs
368
369
  - lib/templates/gherkin/tag.hbs
369
370
  - lib/templates/gherkin/template.hbs
370
- - lib/templates/gherkin/uidcall.hbs
371
371
  - lib/templates/groovy/_body.hbs
372
372
  - lib/templates/groovy/_desc.hbs
373
373
  - lib/templates/groovy/_scenario.hbs
@@ -384,6 +384,7 @@ files:
384
384
  - lib/templates/groovy/index.hbs
385
385
  - lib/templates/groovy/libraries.hbs
386
386
  - lib/templates/groovy/library.hbs
387
+ - lib/templates/groovy/libraryactionword.hbs
387
388
  - lib/templates/groovy/list.hbs
388
389
  - lib/templates/groovy/nullliteral.hbs
389
390
  - lib/templates/groovy/parameter.hbs
@@ -395,7 +396,6 @@ files:
395
396
  - lib/templates/groovy/template.hbs
396
397
  - lib/templates/groovy/test.hbs
397
398
  - lib/templates/groovy/tests.hbs
398
- - lib/templates/groovy/uidcall.hbs
399
399
  - lib/templates/java/_body.hbs
400
400
  - lib/templates/java/_item_as_function.hbs
401
401
  - lib/templates/java/_scenario.hbs
@@ -420,6 +420,7 @@ files:
420
420
  - lib/templates/java/index.hbs
421
421
  - lib/templates/java/libraries.hbs
422
422
  - lib/templates/java/library.hbs
423
+ - lib/templates/java/libraryactionword.hbs
423
424
  - lib/templates/java/list.hbs
424
425
  - lib/templates/java/nullliteral.hbs
425
426
  - lib/templates/java/parameter.hbs
@@ -442,7 +443,6 @@ files:
442
443
  - lib/templates/java/testng/single_test.hbs
443
444
  - lib/templates/java/testng/tests.hbs
444
445
  - lib/templates/java/tests.hbs
445
- - lib/templates/java/uidcall.hbs
446
446
  - lib/templates/java/variable.hbs
447
447
  - lib/templates/java/while.hbs
448
448
  - lib/templates/javascript/_body.hbs
@@ -515,6 +515,7 @@ files:
515
515
  - lib/templates/php/index.hbs
516
516
  - lib/templates/php/libraries.hbs
517
517
  - lib/templates/php/library.hbs
518
+ - lib/templates/php/libraryactionword.hbs
518
519
  - lib/templates/php/list.hbs
519
520
  - lib/templates/php/nullliteral.hbs
520
521
  - lib/templates/php/parameter.hbs
@@ -530,7 +531,6 @@ files:
530
531
  - lib/templates/php/template.hbs
531
532
  - lib/templates/php/test.hbs
532
533
  - lib/templates/php/tests.hbs
533
- - lib/templates/php/uidcall.hbs
534
534
  - lib/templates/php/variable.hbs
535
535
  - lib/templates/php/while.hbs
536
536
  - lib/templates/python/_body.hbs
@@ -667,7 +667,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
667
667
  version: '0'
668
668
  requirements: []
669
669
  rubyforge_project:
670
- rubygems_version: 2.6.10
670
+ rubygems_version: 2.7.6.2
671
671
  signing_key:
672
672
  specification_version: 4
673
673
  summary: Export your tests from HipTest into executable tests.
@@ -1,34 +0,0 @@
1
- module Hiptest
2
- class ActionwordUidIndexer
3
- def initialize(project)
4
- @project = project
5
- @indexed = {}
6
- index_actionwords
7
- end
8
-
9
- def index_actionwords
10
- @project.children[:actionwords].children[:actionwords].each do |actionword|
11
- index_actionword(actionword)
12
- end
13
-
14
- @project.children[:libraries].children[:libraries].each do |library|
15
- library.children[:actionwords].each do |actionword|
16
- index_actionword(actionword, library: library)
17
- end
18
- end
19
- end
20
-
21
- def get_index(uid)
22
- @indexed[uid]
23
- end
24
-
25
- private
26
-
27
- def index_actionword(actionword, library: nil)
28
- @indexed[actionword.children[:uid]] = {
29
- actionword: actionword,
30
- library: library
31
- }
32
- end
33
- end
34
- end
@@ -1,30 +0,0 @@
1
- require 'hiptest-publisher/indexers/actionword_uid_indexer'
2
- require 'hiptest-publisher/nodes'
3
-
4
- module Hiptest
5
- module NodeModifiers
6
- class UidCallReferencerAdder
7
- def self.add(project)
8
- self.new(project).update_uid_calls
9
- end
10
-
11
- def initialize(project)
12
- @project = project
13
- @indexer = ActionwordUidIndexer.new(project)
14
- end
15
-
16
- def update_uid_calls
17
- @project.each_sub_nodes(Hiptest::Nodes::UIDCall) do |uid_call|
18
- index = @indexer.get_index(uid_call.children[:uid])
19
- if index.nil?
20
- uid_call.children[:actionword_name] = "Unknown actionword with UID: #{uid_call.children[:uid]}"
21
- next
22
- end
23
-
24
- uid_call.children[:actionword_name] = index[:actionword].children[:name]
25
- uid_call.children[:library_name] = index[:library].children[:name] unless index[:library].nil?
26
- end
27
- end
28
- end
29
- end
30
- end
@@ -1 +0,0 @@
1
- {{> call}}
@@ -1,2 +0,0 @@
1
- {{#unless in_actionword?}}{{#if use_main_annotation?}}{{#if use_expect_annotation}}expect{{else}}{{rendered_children.annotation}}{{/if}}:
2
- {{/if}}{{/unless}}{{#if context.call_prefix}}{{{context.call_prefix}}}.{{/if}}{{#if has_library?}}get{{{camelize rendered_children.library_name}}}Library().{{/if}}{{{ camelize_lower rendered_children.actionword_name }}}({{{ join rendered_children.all_arguments ', '}}})
@@ -1 +0,0 @@
1
- {{#if context.call_prefix}}{{{context.call_prefix}}}.{{/if}}{{#if has_library?}}get{{{camelize rendered_children.library_name}}}Library().{{/if}}{{{ camelize_lower rendered_children.actionword_name }}}({{{ join rendered_children.all_arguments ', '}}});
@@ -1,2 +0,0 @@
1
- {{#if has_annotation? }}{{#comment '//'}}{{{ rendered_children.gherkin_text }}}{{/comment}}
2
- {{/if}}{{#if context.call_prefix}}{{{ context.call_prefix }}}->{{/if}}{{#if has_library?}}get{{{camelize rendered_children.library_name}}}Library()->{{/if}}{{{ camelize_lower rendered_children.actionword_name }}}({{{ join rendered_children.all_arguments ', '}}});