hiptest-publisher 1.13.0 → 1.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/lib/config/cucumber-groovy.conf +15 -0
  3. data/lib/config/java-junit.conf +6 -0
  4. data/lib/hiptest-publisher.rb +6 -15
  5. data/lib/hiptest-publisher/{diff_displayer.rb → formatters/diff_displayer.rb} +0 -0
  6. data/lib/hiptest-publisher/formatters/reporter.rb +0 -2
  7. data/lib/hiptest-publisher/{actionword_indexer.rb → indexers/actionword_indexer.rb} +8 -1
  8. data/lib/hiptest-publisher/indexers/actionword_uid_indexer.rb +34 -0
  9. data/lib/hiptest-publisher/node_modifiers/actionword_uniq_renamer.rb +39 -0
  10. data/lib/hiptest-publisher/node_modifiers/add_all.rb +23 -0
  11. data/lib/hiptest-publisher/node_modifiers/call_arguments_adder.rb +52 -0
  12. data/lib/hiptest-publisher/{datatable_fixer.rb → node_modifiers/datatable_fixer.rb} +3 -3
  13. data/lib/hiptest-publisher/node_modifiers/gherkin_adder.rb +243 -0
  14. data/lib/hiptest-publisher/node_modifiers/items_orderer.rb +33 -0
  15. data/lib/hiptest-publisher/{parameter_type_adder.rb → node_modifiers/parameter_type_adder.rb} +15 -14
  16. data/lib/hiptest-publisher/{parent_adder.rb → node_modifiers/parent_adder.rb} +4 -4
  17. data/lib/hiptest-publisher/node_modifiers/uid_call_reference_adder.rb +27 -0
  18. data/lib/hiptest-publisher/nodes.rb +49 -4
  19. data/lib/hiptest-publisher/options_parser.rb +8 -1
  20. data/lib/hiptest-publisher/render_context_maker.rb +28 -8
  21. data/lib/hiptest-publisher/signature_differ.rb +17 -7
  22. data/lib/hiptest-publisher/signature_exporter.rb +18 -4
  23. data/lib/hiptest-publisher/xml_parser.rb +24 -1
  24. data/lib/templates/cucumber/groovy/actionwords-library/actionword.hbs +2 -0
  25. data/lib/templates/cucumber/groovy/actionwords-library/libraries.hbs +9 -0
  26. data/lib/templates/cucumber/groovy/actionwords-library/library.hbs +8 -0
  27. data/lib/templates/cucumber/groovy/actionwords-library/uidcall.hbs +1 -0
  28. data/lib/templates/cucumber/groovy/actionwords/actionwords.hbs +1 -1
  29. data/lib/templates/cucumber/groovy/step-definitions/actionword.hbs +1 -1
  30. data/lib/templates/cucumber/groovy/step-definitions/library.hbs +10 -0
  31. data/lib/templates/gherkin/_call.hbs +5 -0
  32. data/lib/templates/gherkin/call.hbs +1 -5
  33. data/lib/templates/gherkin/uidcall.hbs +1 -0
  34. data/lib/templates/java/_item_as_function.hbs +1 -1
  35. data/lib/templates/java/actionwords.hbs +1 -1
  36. data/lib/templates/java/libraries.hbs +9 -0
  37. data/lib/templates/java/library.hbs +7 -0
  38. data/lib/templates/java/uidcall.hbs +1 -0
  39. metadata +24 -9
  40. data/lib/hiptest-publisher/call_arguments_adder.rb +0 -34
  41. data/lib/hiptest-publisher/items_orderer.rb +0 -31
@@ -122,6 +122,13 @@ 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
+
125
132
  def build_arguments(arguments)
126
133
  build_node_list(arguments.css('> arguments > argument'))
127
134
  end
@@ -198,6 +205,7 @@ module Hiptest
198
205
  css_first_content(actionword, '> uid'),
199
206
  css_first_content(actionword, '> description'))
200
207
  end
208
+ alias :build_libraryActionword :build_actionword
201
209
 
202
210
  def build_actionwordSnapshot(actionword)
203
211
  Hiptest::Nodes::Actionword.new(
@@ -303,6 +311,19 @@ module Hiptest
303
311
  return tp
304
312
  end
305
313
 
314
+ def build_actionwordLibraries(libraries)
315
+ Hiptest::Nodes::Libraries.new(
316
+ build_node_list(libraries.css('> actionwordLibrary'))
317
+ )
318
+ end
319
+
320
+ def build_actionwordLibrary(library)
321
+ Hiptest::Nodes::Library.new(
322
+ css_first_content(library, '> name'),
323
+ build_node_list(library.css('> libraryActionwords libraryActionword'))
324
+ )
325
+ end
326
+
306
327
  def build_folderSnapshots(folder_snapshots)
307
328
  build_testPlan(folder_snapshots, '> folderSnapshot')
308
329
  end
@@ -327,7 +348,9 @@ module Hiptest
327
348
  build_node(test_plan_node, Hiptest::Nodes::TestPlan),
328
349
  build_node(scenarios_node, Hiptest::Nodes::Scenarios),
329
350
  build_node(actionwords_node, Hiptest::Nodes::Actionwords),
330
- build_node(css_first(project, '> tests'), Hiptest::Nodes::Tests))
351
+ build_node(css_first(project, '> tests'), Hiptest::Nodes::Tests),
352
+ build_node(css_first(project, '> actionwordLibraries'), Hiptest::Nodes::Libraries)
353
+ )
331
354
 
332
355
  @project.assign_scenarios_to_folders
333
356
  return @project
@@ -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}}
@@ -0,0 +1,9 @@
1
+ package {{{ context.package }}};
2
+
3
+ class ActionwordLibrary {{#curly}}{{#indent}}{{#each library_names}}
4
+ {{camelize this}}Library get{{camelize this}}Library() {{#curly}}{{#indent}}
5
+ return {{camelize this}}Library.instance;
6
+ {{/indent}}
7
+ {{/curly}}
8
+ {{/each}}{{/indent}}
9
+ {{/curly}}
@@ -0,0 +1,8 @@
1
+ package {{{ context.package }}};
2
+
3
+ @Singleton
4
+ class {{camelize rendered_children.name}}Library {{#curly}}{{#indent}}{{#each rendered_children.actionwords}}
5
+ {{{this}}}
6
+ {{/each}}
7
+ {{/indent}}
8
+ {{/curly}}
@@ -0,0 +1 @@
1
+ {{#if context.call_prefix}}{{{context.call_prefix}}}.{{/if}}{{{ camelize_lower rendered_children.actionword_name }}}({{{ join rendered_children.all_arguments ', '}}});
@@ -1,6 +1,6 @@
1
1
  package {{{ context.package }}}
2
2
 
3
- class Actionwords {{#curly}}{{#indent}}{{#each rendered_children.actionwords}}
3
+ class Actionwords {{#if uses_library? }}extends ActionwordLibrary{{/if}}{{#curly}}{{#indent}}{{#each rendered_children.actionwords}}
4
4
  {{{this}}}
5
5
  {{/each}}
6
6
  {{/indent}}
@@ -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 }}}.{{{camelize_lower rendered_children.name}}}({{#if has_parameters?}}{{#join raw_parameter_names ', '}}{{{camelize_lower this}}}{{/join}}{{/if}})
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}})
3
3
  {{/indent}}
4
4
  {{/curly}}
5
5
  {{/if}}
@@ -0,0 +1,10 @@
1
+ package {{{ context.package }}}
2
+
3
+ import cucumber.api.DataTable
4
+
5
+ this.metaClass.mixin(cucumber.api.groovy.EN)
6
+
7
+ Actionwords {{{ context.call_prefix }}} = new Actionwords()
8
+
9
+ {{#each rendered_children.actionwords}}{{{this}}}
10
+ {{/each}}
@@ -0,0 +1,5 @@
1
+ {{> gherkin_text}}{{#if rendered_children.free_text_arg}}{{#indent}}
2
+ """
3
+ {{remove_surrounding_quotes rendered_children.free_text_arg }}
4
+ """{{/indent}}{{/if}}{{#if rendered_children.datatable_arg}}{{#indent}}
5
+ {{remove_surrounding_quotes rendered_children.datatable_arg }}{{/indent}}{{/if}}
@@ -1,5 +1 @@
1
- {{> gherkin_text}}{{#if rendered_children.free_text_arg}}{{#indent}}
2
- """
3
- {{remove_surrounding_quotes rendered_children.free_text_arg }}
4
- """{{/indent}}{{/if}}{{#if rendered_children.datatable_arg}}{{#indent}}
5
- {{remove_surrounding_quotes rendered_children.datatable_arg }}{{/indent}}{{/if}}
1
+ {{> call}}
@@ -0,0 +1 @@
1
+ {{> call}}
@@ -1,4 +1,4 @@
1
- public void {{{ camelize_lower rendered_children.name }}}({{#if has_parameters?}}{{{join rendered_children.parameters ', '}}}{{/if}}) {{#curly}}
1
+ public void {{{ camelize_lower uniq_name }}}({{#if has_parameters?}}{{{join rendered_children.parameters ', '}}}{{/if}}) {{#curly}}
2
2
  {{#clear_empty_lines}}
3
3
  {{#indent}}{{#comment '//'}}{{#if has_tags?}}Tags: {{{ join rendered_children.tags ' '}}}
4
4
  {{/if}}{{#if has_description?}}{{rendered_children.description}}
@@ -1,6 +1,6 @@
1
1
  package {{{ context.package }}};
2
2
 
3
- public class Actionwords {{#curly}}{{#indent}}
3
+ public class Actionwords {{#if uses_library?}}extends ActionwordLibrary {{/if}}{{#curly}}{{#indent}}
4
4
  {{#each rendered_children.actionwords}}
5
5
  {{{this}}}
6
6
  {{/each}}
@@ -0,0 +1,9 @@
1
+ package {{{ context.package }}};
2
+
3
+ public class ActionwordLibrary {{#curly}}{{#indent}}{{#each library_names}}
4
+ public {{camelize this}}Library get{{camelize this}}Library() {{#curly}}{{#indent}}
5
+ return new {{camelize this}}Library();
6
+ {{/indent}}
7
+ {{/curly}}
8
+ {{/each}}{{/indent}}
9
+ {{/curly}}
@@ -0,0 +1,7 @@
1
+ package {{{ context.package }}};
2
+
3
+ public class {{camelize rendered_children.name}}Library extends ActionwordLibrary {{#curly}}{{#indent}}{{#each rendered_children.actionwords}}
4
+ {{{this}}}
5
+ {{/each}}
6
+ {{/indent}}
7
+ {{/curly}}
@@ -0,0 +1 @@
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 ', '}}});
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.13.0
4
+ version: 1.14.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: 2018-08-21 00:00:00.000000000 Z
11
+ date: 2018-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -249,23 +249,28 @@ files:
249
249
  - lib/config/seleniumide.conf
250
250
  - lib/config/specflow.conf
251
251
  - lib/hiptest-publisher.rb
252
- - lib/hiptest-publisher/actionword_indexer.rb
253
- - lib/hiptest-publisher/call_arguments_adder.rb
254
252
  - lib/hiptest-publisher/cli_options_checker.rb
255
253
  - lib/hiptest-publisher/client.rb
256
- - lib/hiptest-publisher/datatable_fixer.rb
257
- - lib/hiptest-publisher/diff_displayer.rb
258
254
  - lib/hiptest-publisher/file_writer.rb
259
255
  - lib/hiptest-publisher/formatters/console_formatter.rb
256
+ - lib/hiptest-publisher/formatters/diff_displayer.rb
260
257
  - lib/hiptest-publisher/formatters/reporter.rb
261
258
  - lib/hiptest-publisher/gherkin_adder.rb
262
259
  - lib/hiptest-publisher/handlebars_helper.rb
263
- - lib/hiptest-publisher/items_orderer.rb
260
+ - lib/hiptest-publisher/indexers/actionword_indexer.rb
261
+ - lib/hiptest-publisher/indexers/actionword_uid_indexer.rb
262
+ - lib/hiptest-publisher/node_modifiers/actionword_uniq_renamer.rb
263
+ - lib/hiptest-publisher/node_modifiers/add_all.rb
264
+ - lib/hiptest-publisher/node_modifiers/call_arguments_adder.rb
265
+ - lib/hiptest-publisher/node_modifiers/datatable_fixer.rb
266
+ - lib/hiptest-publisher/node_modifiers/gherkin_adder.rb
267
+ - lib/hiptest-publisher/node_modifiers/items_orderer.rb
268
+ - lib/hiptest-publisher/node_modifiers/parameter_type_adder.rb
269
+ - lib/hiptest-publisher/node_modifiers/parent_adder.rb
270
+ - lib/hiptest-publisher/node_modifiers/uid_call_reference_adder.rb
264
271
  - lib/hiptest-publisher/nodes.rb
265
272
  - lib/hiptest-publisher/nodes_walker.rb
266
273
  - lib/hiptest-publisher/options_parser.rb
267
- - lib/hiptest-publisher/parameter_type_adder.rb
268
- - lib/hiptest-publisher/parent_adder.rb
269
274
  - lib/hiptest-publisher/project_grapher.rb
270
275
  - lib/hiptest-publisher/render_context_maker.rb
271
276
  - lib/hiptest-publisher/renderer.rb
@@ -330,10 +335,15 @@ files:
330
335
  - lib/templates/csharp/while.hbs
331
336
  - lib/templates/cucumber/actionword.hbs
332
337
  - lib/templates/cucumber/actionwords.hbs
338
+ - lib/templates/cucumber/groovy/actionwords-library/actionword.hbs
339
+ - lib/templates/cucumber/groovy/actionwords-library/libraries.hbs
340
+ - lib/templates/cucumber/groovy/actionwords-library/library.hbs
341
+ - lib/templates/cucumber/groovy/actionwords-library/uidcall.hbs
333
342
  - lib/templates/cucumber/groovy/actionwords/actionwords.hbs
334
343
  - lib/templates/cucumber/groovy/step-definitions/_gherkin_pattern.hbs
335
344
  - lib/templates/cucumber/groovy/step-definitions/actionword.hbs
336
345
  - lib/templates/cucumber/groovy/step-definitions/actionwords.hbs
346
+ - lib/templates/cucumber/groovy/step-definitions/library.hbs
337
347
  - lib/templates/cucumber/groovy/step-definitions/parameter.hbs
338
348
  - lib/templates/cucumber/java/actionword.hbs
339
349
  - lib/templates/cucumber/java/actionwords.hbs
@@ -344,6 +354,7 @@ files:
344
354
  - lib/templates/cucumber/javascript/actionword.hbs
345
355
  - lib/templates/cucumber/javascript/actionwords.hbs
346
356
  - lib/templates/cucumber/parameter.hbs
357
+ - lib/templates/gherkin/_call.hbs
347
358
  - lib/templates/gherkin/_gherkin_text.hbs
348
359
  - lib/templates/gherkin/_scenario.hbs
349
360
  - lib/templates/gherkin/_scenario_outline_title.hbs
@@ -362,6 +373,7 @@ files:
362
373
  - lib/templates/gherkin/stringliteral.hbs
363
374
  - lib/templates/gherkin/tag.hbs
364
375
  - lib/templates/gherkin/template.hbs
376
+ - lib/templates/gherkin/uidcall.hbs
365
377
  - lib/templates/groovy/_body.hbs
366
378
  - lib/templates/groovy/_desc.hbs
367
379
  - lib/templates/groovy/_scenario.hbs
@@ -409,6 +421,8 @@ files:
409
421
  - lib/templates/java/folder.hbs
410
422
  - lib/templates/java/ifthen.hbs
411
423
  - lib/templates/java/index.hbs
424
+ - lib/templates/java/libraries.hbs
425
+ - lib/templates/java/library.hbs
412
426
  - lib/templates/java/list.hbs
413
427
  - lib/templates/java/nullliteral.hbs
414
428
  - lib/templates/java/parameter.hbs
@@ -431,6 +445,7 @@ files:
431
445
  - lib/templates/java/testng/single_test.hbs
432
446
  - lib/templates/java/testng/tests.hbs
433
447
  - lib/templates/java/tests.hbs
448
+ - lib/templates/java/uidcall.hbs
434
449
  - lib/templates/java/variable.hbs
435
450
  - lib/templates/java/while.hbs
436
451
  - lib/templates/javascript/_body.hbs
@@ -1,34 +0,0 @@
1
- require 'hiptest-publisher/actionword_indexer'
2
- require 'hiptest-publisher/nodes'
3
-
4
- module Hiptest
5
- class DefaultArgumentAdder
6
- def self.add(project)
7
- DefaultArgumentAdder.new(project).update_calls
8
- end
9
-
10
- def initialize(project)
11
- @project = project
12
- @indexer = ActionwordIndexer.new(project)
13
- end
14
-
15
- def update_calls
16
- @project.each_sub_nodes(Hiptest::Nodes::Call) do |call|
17
- aw_data = @indexer.get_index(call.children[:actionword])
18
- next if aw_data.nil?
19
-
20
- arguments = {}
21
- call.children[:arguments].each do |arg|
22
- arguments[arg.children[:name]] = arg.children[:value]
23
- end
24
-
25
- call.children[:all_arguments] = aw_data[:parameters].map do |p_name, default_value|
26
- Hiptest::Nodes::Argument.new(
27
- p_name,
28
- arguments.has_key?(p_name) ? arguments[p_name] : default_value
29
- )
30
- end
31
- end
32
- end
33
- end
34
- end
@@ -1,31 +0,0 @@
1
- require 'hiptest-publisher/nodes'
2
-
3
- module Hiptest
4
- class ItemsOrderer
5
- def self.add(project, order)
6
- Hiptest::ItemsOrderer.new(project).order_items(order)
7
- end
8
-
9
- def initialize(project)
10
- @project = project
11
- end
12
-
13
- def order_items(order)
14
- if (order == 'order')
15
- @project.each_sub_nodes(Hiptest::Nodes::Folder) do |folder|
16
- folder.children[:scenarios].sort_by! {|sc| sc.order_in_parent}
17
- folder.children[:subfolders].sort_by! {|f| f.order_in_parent}
18
- end
19
- end
20
-
21
- if (order == 'alpha')
22
- @project.each_sub_nodes(Hiptest::Nodes::Folder) do |folder|
23
- folder.children[:scenarios].sort_by! {|sc| sc.children[:name] }
24
- folder.children[:subfolders].sort_by! {|f| f.children[:name] }
25
- end
26
-
27
- @project.children[:scenarios].children[:scenarios].sort_by! {|sc| sc.children[:name] }
28
- end
29
- end
30
- end
31
- end