hiptest-publisher 0.5.10 → 0.6.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 +31 -5
- data/bin/hiptest-publisher +7 -0
- data/lib/config/cucumber-folders_as_features.conf +18 -0
- data/lib/config/cucumber.conf +18 -0
- data/lib/{templates/java/output_config → config/java.conf} +6 -4
- data/lib/{templates/javascript/jasmine/output_config → config/javascript-jasmine.conf} +0 -0
- data/lib/{templates/javascript/output_config → config/javascript.conf} +1 -1
- data/lib/{templates/python/output_config → config/python.conf} +3 -2
- data/lib/{templates/robotframework/output_config → config/robotframework.conf} +4 -3
- data/lib/{templates/ruby/minitest/output_config → config/ruby-minitest.conf} +0 -0
- data/lib/{templates/ruby/output_config → config/ruby.conf} +1 -1
- data/lib/{templates/seleniumide/output_config → config/seleniumide.conf} +4 -4
- data/lib/hiptest-publisher.rb +96 -76
- data/lib/hiptest-publisher/cli_options_checker.rb +107 -0
- data/lib/hiptest-publisher/handlebars_helper.rb +1 -1
- data/lib/hiptest-publisher/nodes.rb +39 -11
- data/lib/hiptest-publisher/nodes_walker.rb +2 -2
- data/lib/hiptest-publisher/options_parser.rb +304 -45
- data/lib/hiptest-publisher/parent_adder.rb +2 -2
- data/lib/hiptest-publisher/renderer.rb +7 -58
- data/lib/hiptest-publisher/utils.rb +5 -1
- data/lib/hiptest-publisher/xml_parser.rb +2 -1
- data/lib/templates/cucumber/folders_as_features/folder.hbs +4 -0
- data/lib/templates/cucumber/folders_as_features/single_scenario.hbs +14 -0
- data/lib/templates/java/dataset.hbs +1 -1
- data/lib/templates/java/scenarios.hbs +3 -3
- data/lib/templates/java/single_scenario.hbs +3 -3
- data/lib/templates/java/single_test.hbs +3 -3
- data/lib/templates/java/testng/dataset.hbs +1 -1
- data/lib/templates/java/testng/single_scenario.hbs +3 -3
- data/lib/templates/java/testng/single_test.hbs +3 -3
- data/lib/templates/java/tests.hbs +3 -3
- metadata +15 -11
- data/lib/templates/cucumber/output_config +0 -11
@@ -10,9 +10,7 @@ module Hiptest
|
|
10
10
|
attr_reader :rendered
|
11
11
|
include RenderContextMaker
|
12
12
|
|
13
|
-
def self.render(node,
|
14
|
-
context[:language] = language
|
15
|
-
|
13
|
+
def self.render(node, context)
|
16
14
|
renderer = Hiptest::Renderer.new(context)
|
17
15
|
renderer.walk_node(node)
|
18
16
|
renderer.rendered[node]
|
@@ -22,11 +20,7 @@ module Hiptest
|
|
22
20
|
super(:children_first)
|
23
21
|
@rendered = {}
|
24
22
|
@context = context
|
25
|
-
@
|
26
|
-
@compiled_handlebars = {}
|
27
|
-
register_partials()
|
28
|
-
|
29
|
-
Hiptest::HandlebarsHelper.register_helpers(@handlebars, @context)
|
23
|
+
@template_finder = context.template_finder
|
30
24
|
end
|
31
25
|
|
32
26
|
def call_node_walker(node)
|
@@ -41,71 +35,26 @@ module Hiptest
|
|
41
35
|
end
|
42
36
|
end
|
43
37
|
|
44
|
-
def searched_folders()
|
45
|
-
folders = []
|
46
|
-
if @context.has_key?(:framework)
|
47
|
-
folders << "#{@context[:language]}/#{@context[:framework]}"
|
48
|
-
end
|
49
|
-
folders << [@context[:language], 'common']
|
50
|
-
folders = folders.flatten.map {|path| "#{hiptest_publisher_path}/lib/templates/#{path}"}
|
51
|
-
|
52
|
-
if @context.has_key?(:overriden_templates)
|
53
|
-
folders = folders.insert(0, @context[:overriden_templates])
|
54
|
-
end
|
55
|
-
return folders
|
56
|
-
end
|
57
|
-
|
58
|
-
def register_partials()
|
59
|
-
searched_folders.reverse.each do |path|
|
60
|
-
next unless File.directory?(path)
|
61
|
-
Dir.entries(path).select do |file_name|
|
62
|
-
file_path = File.join(path, file_name)
|
63
|
-
next unless File.file?(file_path) && file_name.start_with?('_')
|
64
|
-
@handlebars.register_partial(file_name[1..-5], File.read(file_path))
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
38
|
def render_node(node, render_context)
|
70
|
-
render_context
|
39
|
+
render_context ||= {}
|
71
40
|
render_context[:node] = node
|
72
41
|
render_context[:rendered_children] = @rendered_children
|
73
42
|
render_context[:context] = @context
|
74
43
|
|
75
|
-
template = get_template_path(node)
|
44
|
+
template = @template_finder.get_template_path(normalized_name(node))
|
76
45
|
if template
|
77
|
-
get_compiled_handlebars(template).call(render_context)
|
46
|
+
@template_finder.get_compiled_handlebars(template).call(render_context)
|
78
47
|
else
|
79
48
|
raise ArgumentError.new("no template for node #{node.class}")
|
80
49
|
end
|
81
50
|
end
|
82
51
|
|
83
|
-
def
|
84
|
-
@compiled_handlebars[template] ||= @handlebars.compile(File.read(template))
|
85
|
-
end
|
86
|
-
|
87
|
-
def get_template_by_name(name, extension)
|
88
|
-
searched_folders.map do |path|
|
89
|
-
template_path = File.join(path, "#{name}.#{extension}")
|
90
|
-
template_path if File.file?(template_path)
|
91
|
-
end.compact.first
|
92
|
-
end
|
93
|
-
|
94
|
-
def fallback_template(extension)
|
95
|
-
@fallback_template ||= begin
|
96
|
-
if @context[:fallback_template]
|
97
|
-
get_template_by_name(@context[:fallback_template], extension)
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
def get_template_path(node, extension = 'hbs')
|
52
|
+
def normalized_name(node)
|
103
53
|
normalized_name = node.class.name.split('::').last.downcase
|
104
54
|
unless @context[:forced_templates][normalized_name].nil?
|
105
55
|
normalized_name = @context[:forced_templates][normalized_name]
|
106
56
|
end
|
107
|
-
|
108
|
-
get_template_by_name(normalized_name, extension) || fallback_template(extension)
|
57
|
+
normalized_name
|
109
58
|
end
|
110
59
|
end
|
111
60
|
end
|
@@ -24,6 +24,10 @@ def pluralize(count, singular)
|
|
24
24
|
"#{count} #{word}"
|
25
25
|
end
|
26
26
|
|
27
|
+
def singularize(name)
|
28
|
+
name.to_s.chomp("s")
|
29
|
+
end
|
30
|
+
|
27
31
|
def make_filter(options)
|
28
32
|
ids = options.filter_ids.split(',').map {|id| "filter[]=id:#{id}"}
|
29
33
|
tags = options.filter_tags.split(',').map {|tag| "filter[]=tag:#{tag}"}
|
@@ -41,7 +45,7 @@ def fetch_project_export(options)
|
|
41
45
|
end
|
42
46
|
|
43
47
|
puts "URL: #{url}".white if options.verbose
|
44
|
-
open(url, :ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE)
|
48
|
+
open(url, "User-Agent" => 'Ruby/hiptest-publisher', :ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE)
|
45
49
|
end
|
46
50
|
|
47
51
|
def show_status_message(message, status=nil)
|
@@ -271,7 +271,8 @@ module Hiptest
|
|
271
271
|
Hiptest::Nodes::Folder.new(
|
272
272
|
css_first_content(folder, 'uid'),
|
273
273
|
css_first_content(folder, 'parentUid'),
|
274
|
-
css_first_content(folder, 'name')
|
274
|
+
css_first_content(folder, 'name'),
|
275
|
+
css_first_content(folder, 'description'))
|
275
276
|
end
|
276
277
|
alias :build_folderSnapshot :build_folder
|
277
278
|
|
@@ -0,0 +1,14 @@
|
|
1
|
+
{{#if has_datasets?}}
|
2
|
+
Scenario Outline: {{{ rendered_children.name }}}{{#indent}}
|
3
|
+
{{#each rendered_children.body}}{{{ this }}}
|
4
|
+
{{/each}}
|
5
|
+
Examples:{{#indent}}
|
6
|
+
| {{ join rendered_children.parameters ' | ' }} | hiptest-uid |
|
7
|
+
{{{rendered_children.datatable}}}
|
8
|
+
{{/indent}}{{/indent}}
|
9
|
+
{{else}}
|
10
|
+
Scenario: {{{ rendered_children.name }}}{{#if rendered_children.uid}} (uid:{{{rendered_children.uid}}}){{/if}}{{#indent}}
|
11
|
+
{{#each rendered_children.body}}{{{ this }}}
|
12
|
+
{{/each}}
|
13
|
+
{{/indent}}
|
14
|
+
{{/if}}
|
@@ -1,3 +1,3 @@
|
|
1
1
|
public void test{{{ camelize scenario_name}}}{{{ camelize rendered_children.name}}}{{#if rendered_children.uid}}Uid{{{ normalize rendered_children.uid}}}{{/if}}() {{#curly}}
|
2
|
-
|
2
|
+
{{#indent}}{{{ camelize_lower scenario_name }}}({{{ join rendered_children.arguments ', '}}});{{/indent}}
|
3
3
|
{{/curly}}
|
@@ -3,9 +3,9 @@ package {{{ context.package }}};
|
|
3
3
|
import junit.framework.TestCase;
|
4
4
|
|
5
5
|
public class {{{ clear_extension context.filename }}} extends TestCase {{#curly}}
|
6
|
-
|
7
|
-
|
8
|
-
{{#
|
6
|
+
{{#indent}}
|
7
|
+
public Actionwords {{{ context.call_prefix }}} = new Actionwords();
|
8
|
+
{{#each rendered_children.scenarios}}{{{this}}}
|
9
9
|
{{/each}}
|
10
10
|
{{/indent}}
|
11
11
|
{{/curly}}
|
@@ -2,10 +2,10 @@ package {{{ context.package }}};
|
|
2
2
|
|
3
3
|
import junit.framework.TestCase;
|
4
4
|
|
5
|
-
public class {{{ clear_extension context.
|
6
|
-
|
7
|
-
public Actionwords {{{ context.call_prefix }}} = new Actionwords();
|
5
|
+
public class {{{ clear_extension context.filename }}} extends TestCase {{#curly}}
|
8
6
|
{{#indent}}
|
7
|
+
public Actionwords {{{ context.call_prefix }}} = new Actionwords();
|
8
|
+
|
9
9
|
{{> scenario}}
|
10
10
|
{{/indent}}
|
11
11
|
{{/curly}}
|
@@ -2,10 +2,10 @@ package {{{ context.package }}};
|
|
2
2
|
|
3
3
|
import junit.framework.TestCase;
|
4
4
|
|
5
|
-
public class {{{ clear_extension context.
|
6
|
-
|
7
|
-
public Actionwords {{{ context.call_prefix }}} = new Actionwords();
|
5
|
+
public class {{{ clear_extension context.filename }}} extends TestCase {{#curly}}
|
8
6
|
{{#indent}}
|
7
|
+
public Actionwords {{{ context.call_prefix }}} = new Actionwords();
|
8
|
+
|
9
9
|
{{> scenario}}
|
10
10
|
{{/indent}}
|
11
11
|
{{/curly}}
|
@@ -1,4 +1,4 @@
|
|
1
1
|
@Test
|
2
2
|
public void {{{ camelize_lower scenario_name}}}{{{ camelize rendered_children.name}}}{{#if rendered_children.uid}}Uid{{{ normalize rendered_children.uid}}}{{/if}}() {{#curly}}
|
3
|
-
|
3
|
+
{{#indent}}{{{ camelize_lower scenario_name }}}({{{ join rendered_children.arguments ', '}}});{{/indent}}
|
4
4
|
{{/curly}}
|
@@ -2,10 +2,10 @@ package {{{ context.package }}};
|
|
2
2
|
|
3
3
|
import org.testng.annotations.*;
|
4
4
|
|
5
|
-
public class {{{ clear_extension context.
|
6
|
-
|
7
|
-
public Actionwords {{{ context.call_prefix }}} = new Actionwords();
|
5
|
+
public class {{{ clear_extension context.filename }}} {{#curly}}
|
8
6
|
{{#indent}}
|
7
|
+
public Actionwords {{{ context.call_prefix }}} = new Actionwords();
|
8
|
+
|
9
9
|
{{> scenario}}
|
10
10
|
{{/indent}}
|
11
11
|
{{/curly}}
|
@@ -2,10 +2,10 @@ package {{{ context.package }}};
|
|
2
2
|
|
3
3
|
import org.testng.annotations.*;
|
4
4
|
|
5
|
-
public class {{{ clear_extension context.
|
6
|
-
|
7
|
-
public Actionwords {{{ context.call_prefix }}} = new Actionwords();
|
5
|
+
public class {{{ clear_extension context.filename }}} {{#curly}}
|
8
6
|
{{#indent}}
|
7
|
+
public Actionwords {{{ context.call_prefix }}} = new Actionwords();
|
8
|
+
|
9
9
|
{{> scenario}}
|
10
10
|
{{/indent}}
|
11
11
|
{{/curly}}
|
@@ -3,9 +3,9 @@ package {{{ context.package }}};
|
|
3
3
|
import junit.framework.TestCase;
|
4
4
|
|
5
5
|
public class {{{ clear_extension context.filename }}} extends TestCase {{#curly}}
|
6
|
-
|
7
|
-
|
8
|
-
{{#
|
6
|
+
{{#indent}}
|
7
|
+
public Actionwords {{{ context.call_prefix }}} = new Actionwords();
|
8
|
+
{{#each rendered_children.tests}}{{{this}}}
|
9
9
|
{{/each}}
|
10
10
|
{{/indent}}
|
11
11
|
{{/curly}}
|
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.6.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: 2015-
|
11
|
+
date: 2015-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -239,9 +239,20 @@ extra_rdoc_files:
|
|
239
239
|
files:
|
240
240
|
- README.md
|
241
241
|
- bin/hiptest-publisher
|
242
|
+
- lib/config/cucumber-folders_as_features.conf
|
243
|
+
- lib/config/cucumber.conf
|
244
|
+
- lib/config/java.conf
|
245
|
+
- lib/config/javascript-jasmine.conf
|
246
|
+
- lib/config/javascript.conf
|
247
|
+
- lib/config/python.conf
|
248
|
+
- lib/config/robotframework.conf
|
249
|
+
- lib/config/ruby-minitest.conf
|
250
|
+
- lib/config/ruby.conf
|
251
|
+
- lib/config/seleniumide.conf
|
242
252
|
- lib/hiptest-publisher.rb
|
243
253
|
- lib/hiptest-publisher/actionword_indexer.rb
|
244
254
|
- lib/hiptest-publisher/call_arguments_adder.rb
|
255
|
+
- lib/hiptest-publisher/cli_options_checker.rb
|
245
256
|
- lib/hiptest-publisher/formatters/console_formatter.rb
|
246
257
|
- lib/hiptest-publisher/formatters/reporter.rb
|
247
258
|
- lib/hiptest-publisher/gherkin_adder.rb
|
@@ -272,7 +283,8 @@ files:
|
|
272
283
|
- lib/templates/cucumber/dataset.hbs
|
273
284
|
- lib/templates/cucumber/datatable.hbs
|
274
285
|
- lib/templates/cucumber/empty.hbs
|
275
|
-
- lib/templates/cucumber/
|
286
|
+
- lib/templates/cucumber/folders_as_features/folder.hbs
|
287
|
+
- lib/templates/cucumber/folders_as_features/single_scenario.hbs
|
276
288
|
- lib/templates/cucumber/parameter.hbs
|
277
289
|
- lib/templates/cucumber/scenarios.hbs
|
278
290
|
- lib/templates/cucumber/single_scenario.hbs
|
@@ -296,7 +308,6 @@ files:
|
|
296
308
|
- lib/templates/java/index.hbs
|
297
309
|
- lib/templates/java/list.hbs
|
298
310
|
- lib/templates/java/nullliteral.hbs
|
299
|
-
- lib/templates/java/output_config
|
300
311
|
- lib/templates/java/parameter.hbs
|
301
312
|
- lib/templates/java/parenthesis.hbs
|
302
313
|
- lib/templates/java/property.hbs
|
@@ -338,14 +349,12 @@ files:
|
|
338
349
|
- lib/templates/javascript/jasmine/_before_each.hbs
|
339
350
|
- lib/templates/javascript/jasmine/_scenario.hbs
|
340
351
|
- lib/templates/javascript/jasmine/dataset.hbs
|
341
|
-
- lib/templates/javascript/jasmine/output_config
|
342
352
|
- lib/templates/javascript/jasmine/scenarios.hbs
|
343
353
|
- lib/templates/javascript/jasmine/single_scenario.hbs
|
344
354
|
- lib/templates/javascript/jasmine/single_test.hbs
|
345
355
|
- lib/templates/javascript/jasmine/tests.hbs
|
346
356
|
- lib/templates/javascript/list.hbs
|
347
357
|
- lib/templates/javascript/nullliteral.hbs
|
348
|
-
- lib/templates/javascript/output_config
|
349
358
|
- lib/templates/javascript/parameter.hbs
|
350
359
|
- lib/templates/javascript/parenthesis.hbs
|
351
360
|
- lib/templates/javascript/project.hbs
|
@@ -378,7 +387,6 @@ files:
|
|
378
387
|
- lib/templates/python/index.hbs
|
379
388
|
- lib/templates/python/list.hbs
|
380
389
|
- lib/templates/python/nullliteral.hbs
|
381
|
-
- lib/templates/python/output_config
|
382
390
|
- lib/templates/python/parameter.hbs
|
383
391
|
- lib/templates/python/parenthesis.hbs
|
384
392
|
- lib/templates/python/project.hbs
|
@@ -410,7 +418,6 @@ files:
|
|
410
418
|
- lib/templates/robotframework/index.hbs
|
411
419
|
- lib/templates/robotframework/list.hbs
|
412
420
|
- lib/templates/robotframework/nullliteral.hbs
|
413
|
-
- lib/templates/robotframework/output_config
|
414
421
|
- lib/templates/robotframework/parameter.hbs
|
415
422
|
- lib/templates/robotframework/parenthesis.hbs
|
416
423
|
- lib/templates/robotframework/project.hbs
|
@@ -446,14 +453,12 @@ files:
|
|
446
453
|
- lib/templates/ruby/minitest/_item_as_def.hbs
|
447
454
|
- lib/templates/ruby/minitest/_scenario.hbs
|
448
455
|
- lib/templates/ruby/minitest/dataset.hbs
|
449
|
-
- lib/templates/ruby/minitest/output_config
|
450
456
|
- lib/templates/ruby/minitest/scenario.hbs
|
451
457
|
- lib/templates/ruby/minitest/scenarios.hbs
|
452
458
|
- lib/templates/ruby/minitest/single_scenario.hbs
|
453
459
|
- lib/templates/ruby/minitest/single_test.hbs
|
454
460
|
- lib/templates/ruby/minitest/test.hbs
|
455
461
|
- lib/templates/ruby/minitest/tests.hbs
|
456
|
-
- lib/templates/ruby/output_config
|
457
462
|
- lib/templates/ruby/parameter.hbs
|
458
463
|
- lib/templates/ruby/parenthesis.hbs
|
459
464
|
- lib/templates/ruby/project.hbs
|
@@ -472,7 +477,6 @@ files:
|
|
472
477
|
- lib/templates/seleniumide/argument.hbs
|
473
478
|
- lib/templates/seleniumide/call.hbs
|
474
479
|
- lib/templates/seleniumide/empty.hbs
|
475
|
-
- lib/templates/seleniumide/output_config
|
476
480
|
- lib/templates/seleniumide/single_test.hbs
|
477
481
|
- lib/templates/seleniumide/step.hbs
|
478
482
|
- lib/templates/seleniumide/stringliteral.hbs
|
@@ -1,11 +0,0 @@
|
|
1
|
-
[tests]
|
2
|
-
filename = 'features.feature'
|
3
|
-
scenario_filename = '%s.feature'
|
4
|
-
indentation = " "
|
5
|
-
fallback_template = 'empty'
|
6
|
-
|
7
|
-
[actionwords]
|
8
|
-
filename = 'step_definitions.rb'
|
9
|
-
indentation = " "
|
10
|
-
naming_convention = 'underscore'
|
11
|
-
fallback_template = 'empty'
|