hiptest-publisher 0.11.0 → 0.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/config/robotframework.conf +1 -0
- data/lib/hiptest-publisher/handlebars_helper.rb +14 -6
- data/lib/hiptest-publisher/render_context_maker.rb +23 -4
- data/lib/hiptest-publisher/renderer.rb +16 -0
- data/lib/hiptest-publisher/string.rb +15 -5
- data/lib/templates/robotframework/_scenario.hbs +2 -2
- data/lib/templates/robotframework/call.hbs +1 -2
- data/lib/templates/robotframework/folder.hbs +30 -1
- data/lib/templates/robotframework/scenarios.hbs +22 -1
- data/lib/templates/robotframework/test.hbs +1 -0
- data/lib/templates/robotframework/tests.hbs +7 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be4a3b2d0bbf17ed7a2af2d6d5046741f7409132
|
4
|
+
data.tar.gz: 978b02362aaf8f9044aab395f52e36b6639eb9bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aeb755943f4b5e5d3edd6a2449d782de32622dd7d4e233f6723cb5c90bd09a4f051bb1b3122ef16fa0bc969758d65fdf8e2c551f6dee4a6e08d51a504c35b834
|
7
|
+
data.tar.gz: 66d01375e139672cfc2976fc67273128e89690beb703e6e8f2692729ed2cdb454768134a1dadeea9c0d70e8bc2306f7a3445377b9a48414d1298699a06ae5976
|
@@ -17,6 +17,7 @@ module Hiptest
|
|
17
17
|
:normalize,
|
18
18
|
:normalize_lower,
|
19
19
|
:normalize_with_dashes,
|
20
|
+
:normalize_with_spaces,
|
20
21
|
:underscore,
|
21
22
|
:camelize,
|
22
23
|
:camelize_lower,
|
@@ -46,7 +47,10 @@ module Hiptest
|
|
46
47
|
end
|
47
48
|
|
48
49
|
def hh_join(context, items, joiner, block, else_block = nil)
|
49
|
-
joiner =
|
50
|
+
joiner = joiner.to_s
|
51
|
+
joiner.gsub!(/\\t/, "\t")
|
52
|
+
joiner.gsub!(/\\n/, "\n")
|
53
|
+
|
50
54
|
|
51
55
|
if block.nil? || block.items.empty?
|
52
56
|
"#{items.join(joiner)}"
|
@@ -78,17 +82,21 @@ module Hiptest
|
|
78
82
|
end
|
79
83
|
end
|
80
84
|
|
81
|
-
def
|
82
|
-
indentation = @context[:indentation] || ' '
|
83
|
-
indentation = "\t" if indentation == '\t'
|
84
|
-
|
85
|
+
def hh_prepend(context, str, block)
|
85
86
|
block.fn(context).split("\n").map do |line|
|
86
|
-
indented = "#{
|
87
|
+
indented = "#{str}#{line}"
|
87
88
|
indented = "" if indented.strip.empty?
|
88
89
|
indented
|
89
90
|
end.join("\n")
|
90
91
|
end
|
91
92
|
|
93
|
+
def hh_indent(context, block)
|
94
|
+
indentation = @context[:indentation] || ' '
|
95
|
+
indentation = "\t" if indentation == '\t'
|
96
|
+
|
97
|
+
hh_prepend(context, indentation, block)
|
98
|
+
end
|
99
|
+
|
92
100
|
def hh_clear_empty_lines(context, block)
|
93
101
|
block.fn(context).split("\n").map do |line|
|
94
102
|
line unless line.strip.empty?
|
@@ -28,15 +28,15 @@ module Hiptest
|
|
28
28
|
:self_name => folder.children[:name],
|
29
29
|
:has_tags? => !folder.children[:tags].empty?,
|
30
30
|
:has_step? => has_step?(folder),
|
31
|
-
:is_empty? => folder.children[:body].empty
|
31
|
+
:is_empty? => folder.children[:body].empty?,
|
32
|
+
:datatables_present? => datatable_present?(folder),
|
32
33
|
)
|
33
34
|
end
|
34
35
|
|
35
36
|
def walk_scenario(scenario)
|
36
|
-
datatable = scenario.children[:datatable]
|
37
37
|
walk_item(scenario).merge(walk_relative_item(scenario)).merge(
|
38
38
|
:project_name => scenario.parent.parent.children[:name],
|
39
|
-
:has_datasets? =>
|
39
|
+
:has_datasets? => has_datasets?(scenario)
|
40
40
|
)
|
41
41
|
end
|
42
42
|
|
@@ -52,6 +52,7 @@ module Hiptest
|
|
52
52
|
{
|
53
53
|
:project_name => project.children[:name],
|
54
54
|
:self_name => project.children[:name],
|
55
|
+
:datatables_present? => datatable_present?(scenarios)
|
55
56
|
}
|
56
57
|
end
|
57
58
|
|
@@ -71,7 +72,7 @@ module Hiptest
|
|
71
72
|
project = tests.parent
|
72
73
|
{
|
73
74
|
:project_name => project.children[:name],
|
74
|
-
:self_name => project.children[:name]
|
75
|
+
:self_name => project.children[:name]
|
75
76
|
}
|
76
77
|
end
|
77
78
|
|
@@ -123,5 +124,23 @@ module Hiptest
|
|
123
124
|
end
|
124
125
|
false
|
125
126
|
end
|
127
|
+
|
128
|
+
def has_datasets?(scenario)
|
129
|
+
datatable = scenario.children[:datatable]
|
130
|
+
datatable ? !datatable.children[:datasets].empty? : false
|
131
|
+
end
|
132
|
+
|
133
|
+
def datatable_present?(container)
|
134
|
+
datatables_present = false
|
135
|
+
|
136
|
+
container.children[:scenarios].each do |scenario|
|
137
|
+
if has_datasets?(scenario)
|
138
|
+
datatables_present = true
|
139
|
+
break
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
return datatables_present
|
144
|
+
end
|
126
145
|
end
|
127
146
|
end
|
@@ -25,6 +25,22 @@ module Hiptest
|
|
25
25
|
def call_node_walker(node)
|
26
26
|
if node.is_a? Hiptest::Nodes::Node
|
27
27
|
@rendered_children = {}
|
28
|
+
|
29
|
+
if node.is_a?(Hiptest::Nodes::Folder) || node.is_a?(Hiptest::Nodes::Scenarios)
|
30
|
+
# For Robot framework, we need direct access to every scenario
|
31
|
+
# datatables and body rendered ....
|
32
|
+
|
33
|
+
@rendered_children[:splitted_scenarios] = node.children[:scenarios].map {|sc|
|
34
|
+
{
|
35
|
+
name: @rendered[sc.children[:name]],
|
36
|
+
uid: @rendered[sc.children[:uid]],
|
37
|
+
datatable: @rendered[sc.children[:datatable]],
|
38
|
+
parameters: @rendered[sc.children[:parameters]],
|
39
|
+
body: @rendered[sc.children[:body]]
|
40
|
+
}
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
28
44
|
node.children.each {|name, child| @rendered_children[name] = @rendered[child]}
|
29
45
|
@rendered[node] = render_node(node, super(node))
|
30
46
|
elsif node.is_a? Array
|
@@ -8,14 +8,20 @@ class String
|
|
8
8
|
I18n.transliterate(self)
|
9
9
|
end
|
10
10
|
|
11
|
-
def normalize(keep_dashes=false)
|
11
|
+
def normalize(keep_dashes=false, keep_spaces=false)
|
12
12
|
literated = self.literate
|
13
13
|
literated.strip!
|
14
|
-
|
15
|
-
if
|
16
|
-
literated.gsub!(
|
14
|
+
|
15
|
+
if keep_spaces
|
16
|
+
literated.gsub!(/\s+/, ' ')
|
17
|
+
literated.gsub!(/[^a-zA-Z0-9_\- "']/, '')
|
17
18
|
else
|
18
|
-
literated.gsub!(/\
|
19
|
+
literated.gsub!(/\s+/, '_')
|
20
|
+
if keep_dashes
|
21
|
+
literated.gsub!(/[^a-zA-Z0-9_\-]/, '')
|
22
|
+
else
|
23
|
+
literated.gsub!(/\W/, '')
|
24
|
+
end
|
19
25
|
end
|
20
26
|
literated
|
21
27
|
end
|
@@ -30,6 +36,10 @@ class String
|
|
30
36
|
self.normalize(true)
|
31
37
|
end
|
32
38
|
|
39
|
+
def normalize_with_spaces
|
40
|
+
self.normalize(false, true)
|
41
|
+
end
|
42
|
+
|
33
43
|
def underscore
|
34
44
|
# based on:
|
35
45
|
# http://stackoverflow.com/questions/1509915/converting-camel-case-to-underscore-case-in-ruby
|
@@ -1,5 +1,5 @@
|
|
1
1
|
{{#if has_datasets?}}
|
2
|
-
Test Template {{{
|
2
|
+
Test Template {{{ normalize_with_spaces rendered_children.name }}}
|
3
3
|
|
4
4
|
*** Test Cases ***{{#each node.children.parameters}}{{{ tab }}}{{{ this.children.name}}}{{/each}}
|
5
5
|
{{{ rendered_children.datatable }}}
|
@@ -8,4 +8,4 @@ Test Template {{{ underscore rendered_children.name }}}
|
|
8
8
|
{{else}}
|
9
9
|
*** Test Cases ***
|
10
10
|
{{/if}}
|
11
|
-
{{>
|
11
|
+
{{{normalize_with_spaces rendered_children.name }}}{{#if rendered_children.uid}} (uid:{{normalize rendered_children.uid}}){{/if}}{{> keyword_body}}
|
@@ -1,2 +1 @@
|
|
1
|
-
{{
|
2
|
-
{{/if}}{{{ underscore rendered_children.actionword }}}{{#if has_arguments?}}{{tab}}{{{ join rendered_children.arguments '\t'}}}{{/if}}
|
1
|
+
{{{ underscore rendered_children.actionword }}}{{#if has_arguments?}}{{tab}}{{{ join rendered_children.arguments '\t'}}}{{/if}}
|
@@ -1 +1,30 @@
|
|
1
|
-
|
1
|
+
*** Settings ***
|
2
|
+
Documentation
|
3
|
+
{{#comment '... '}}{{#clear_empty_lines}}
|
4
|
+
{{{ rendered_children.description}}}
|
5
|
+
{{#if has_tags?}}
|
6
|
+
Tags: {{{ join rendered_children.tags ' '}}}
|
7
|
+
{{/if}}{{/clear_empty_lines}}{{/comment}}
|
8
|
+
Resource keywords.txt
|
9
|
+
{{#unless is_empty?}}
|
10
|
+
Test Setup{{tab}}Run Keywords{{tab}}{{join rendered_children.body "\n... AND \t"}}
|
11
|
+
{{/unless}}
|
12
|
+
*** Test Cases ***{{#if datatables_present?}}
|
13
|
+
{{#each rendered_children.splitted_scenarios}}
|
14
|
+
{{#if this.datatable}}{{normalize_with_spaces this.name}}{{#indent}}
|
15
|
+
[Template]{{tab}}{{normalize_with_spaces this.name}} keyword
|
16
|
+
{{this.datatable}}{{/indent}}
|
17
|
+
{{else}}{{normalize_with_spaces this.name}}{{#if this.uid}}(uid:{{normalize this.uid}}){{/if}}{{#indent}}
|
18
|
+
{{join this.body '\n'}}{{/indent}}
|
19
|
+
{{/if}}{{/each}}
|
20
|
+
*** Keywords ***
|
21
|
+
|
22
|
+
{{#each rendered_children.splitted_scenarios}}{{#if this.datatable}}{{normalize_with_spaces this.name}} keyword{{#indent}}
|
23
|
+
[Arguments]{{tab}}${{#curly}}__test_name{{/curly}}{{tab}}{{join this.parameters '\t'}}
|
24
|
+
{{join this.body '\n'}}{{/indent}}
|
25
|
+
|
26
|
+
{{/if}}{{/each}}{{else}}
|
27
|
+
{{#each rendered_children.splitted_scenarios}}
|
28
|
+
{{normalize_with_spaces this.name}}{{#if this.uid}}(uid:{{normalize this.uid}}){{/if}}{{#indent}}
|
29
|
+
{{join this.body '\n'}}{{/indent}}
|
30
|
+
{{/each}}{{/if}}
|
@@ -1 +1,22 @@
|
|
1
|
-
|
1
|
+
*** Settings ***
|
2
|
+
Resource keywords.txt
|
3
|
+
|
4
|
+
*** Test Cases ***{{#if datatables_present?}}
|
5
|
+
{{#each rendered_children.splitted_scenarios}}
|
6
|
+
{{#if this.datatable}}{{this.name}}{{#indent}}
|
7
|
+
[Template]{{tab}}{{this.name}} keyword
|
8
|
+
{{this.datatable}}{{/indent}}
|
9
|
+
{{else}}{{normalize_with_spaces this.name}}{{#if rendered_children.uid}} (uid:{{normalize rendered_children.uid}}){{/if}}{{#indent}}
|
10
|
+
{{join this.body '\n'}}{{/indent}}
|
11
|
+
{{/if}}{{/each}}
|
12
|
+
*** Keywords ***
|
13
|
+
|
14
|
+
{{#each rendered_children.splitted_scenarios}}{{#if this.datatable}}{{normalize_with_spaces this.name}} keyword{{#indent}}
|
15
|
+
[Arguments]{{tab}}${{#curly}}__test_name{{/curly}}{{tab}}{{join this.parameters '\t'}}
|
16
|
+
{{join this.body '\n'}}{{/indent}}
|
17
|
+
|
18
|
+
{{/if}}{{/each}}{{else}}
|
19
|
+
{{#each rendered_children.splitted_scenarios}}
|
20
|
+
{{normalize_with_spaces this.name}}{{#if rendered_children.uid}} (uid:{{normalize rendered_children.uid}}){{/if}}{{#indent}}
|
21
|
+
{{join this.body '\n'}}{{/indent}}
|
22
|
+
{{/each}}{{/if}}
|
@@ -0,0 +1 @@
|
|
1
|
+
{{{normalize_with_spaces rendered_children.name }}}{{#if rendered_children.uid}}_uid{{{ normalize rendered_children.uid}}}{{/if}}{{> keyword_body}}
|
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.11.
|
4
|
+
version: 0.11.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: 2016-
|
11
|
+
date: 2016-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -516,6 +516,7 @@ files:
|
|
516
516
|
- lib/templates/robotframework/single_test.hbs
|
517
517
|
- lib/templates/robotframework/stringliteral.hbs
|
518
518
|
- lib/templates/robotframework/template.hbs
|
519
|
+
- lib/templates/robotframework/test.hbs
|
519
520
|
- lib/templates/robotframework/tests.hbs
|
520
521
|
- lib/templates/robotframework/variable.hbs
|
521
522
|
- lib/templates/robotframework/while.hbs
|